identity

package
v0.0.0-...-6043874 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

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
	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 netflow-api 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

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

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