identity

package
v0.0.0-...-e00d9b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

****************************************************************************** * * Copyright 2022 SAP SE * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You should have received a copy of the License along with this * program. If not, you may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ******************************************************************************

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Identity

type Identity interface {
	// Return the main gophercloud client from which the respective service
	// clients can be derived. For Mock drivers, this returns nil, so test code
	// should be prepared to handle a nil Client() where appropriate.
	Client() (*gophercloud.ProviderClient, error)
	AuthOptions() *gophercloud.AuthOptions
	/********** requests to Keystone **********/
	ValidateToken(token string) (policy.Context, error)
	Authenticate(credentials *gophercloud.AuthOptions) (policy.Context, error)
	DomainName(id string) (string, error)
	ProjectName(id string) (string, error)
	UserName(id string) (string, error)
	UserID(name string) (string, error)
	RoleName(id string) (string, error)
	GroupName(id string) (string, error)
}

Identity is an interface that wraps the authentication of the service user and token checking of API users. Because it is an interface, the real implementation can be mocked away in unit tests.

type Keystone

type Keystone struct {
	TokenRenewalMutex *sync.Mutex // Used for controlling the token refresh process
}

Keystone Openstack Keystone implementation

func (Keystone) AuthOptions

func (d Keystone) AuthOptions() *gophercloud.AuthOptions

AuthOptions fills in Keystone options with hermes config values

func (Keystone) Authenticate

func (d Keystone) Authenticate(credentials *gophercloud.AuthOptions) (policy.Context, error)

Authenticate with Keystone

func (Keystone) Client

func (d Keystone) Client() (*gophercloud.ProviderClient, error)

Client for Keystone connection

func (Keystone) DomainName

func (d Keystone) DomainName(id string) (string, error)

DomainName with caching

func (Keystone) GroupName

func (d Keystone) GroupName(id string) (string, error)

GroupName with caching

func (Keystone) ProjectName

func (d Keystone) ProjectName(id string) (string, error)

ProjectName with caching

func (Keystone) RefreshToken

func (d Keystone) RefreshToken() error

RefreshToken fetches a new Identity auth token. It is also used to fetch the initial token on startup.

func (Keystone) RoleName

func (d Keystone) RoleName(id string) (string, error)

RoleName with caching

func (Keystone) UserID

func (d Keystone) UserID(name string) (string, error)

UserID with caching

func (Keystone) UserName

func (d Keystone) UserName(id string) (string, error)

UserName with Caching

func (Keystone) ValidateToken

func (d Keystone) ValidateToken(token string) (policy.Context, error)

ValidateToken checks a token with Keystone

type Mock

type Mock struct{}

Mock TODO: emnpty struct? Is there a better way?

func (Mock) AuthOptions

func (d Mock) AuthOptions() *gophercloud.AuthOptions

AuthOptions for mocking keystone

func (Mock) Authenticate

func (d Mock) Authenticate(credentials *gophercloud.AuthOptions) (policy.Context, error)

Authenticate for Mocking Keystone

func (Mock) Client

func (d Mock) Client() (*gophercloud.ProviderClient, error)

Client for mocking keystone

func (Mock) DomainName

func (d Mock) DomainName(id string) (string, error)

DomainName for mocking keystone

func (Mock) GroupName

func (d Mock) GroupName(id string) (string, error)

GroupName for mocking keystone

func (Mock) ProjectName

func (d Mock) ProjectName(id string) (string, error)

ProjectName for mocking keystone

func (Mock) RoleName

func (d Mock) RoleName(id string) (string, error)

RoleName for mocking keystone

func (Mock) UserID

func (d Mock) UserID(name string) (string, error)

UserID for mocking keystone

func (Mock) UserName

func (d Mock) UserName(id string) (string, error)

UserName for mocking keystone

func (Mock) ValidateToken

func (d Mock) ValidateToken(token string) (policy.Context, error)

ValidateToken for mocking keystone

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL