identity

package
v2.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: LGPL-3.0 Imports: 11 Imported by: 29

Documentation

Index

Constants

View Source
const (
	AuthLegacy     = AuthMode(iota) // Legacy authentication
	AuthUserPass                    // Username + password authentication
	AuthKeyPair                     // Access/secret key pair authentication
	AuthUserPassV3                  // Username + password authentication (v3 API)
)

Variables

View Source
var (
	// CredEnvAuthURL is used for Credentials.URL.
	CredEnvAuthURL = []string{
		"OS_AUTH_URL",
	}
	// CredEnvUser is used for Credentials.User.
	CredEnvUser = []string{
		"OS_USERNAME",
		"NOVA_USERNAME",
		"OS_ACCESS_KEY",
		"NOVA_API_KEY",
	}
	// CredEnvSecrets is used for Credentials.Secrets.
	CredEnvSecrets = []string{
		"OS_PASSWORD",
		"NOVA_PASSWORD",
		"OS_SECRET_KEY",

		"AWS_SECRET_ACCESS_KEY",

		"EC2_SECRET_KEYS",
	}
	// CredEnvRegion is used for Credentials.Region.
	CredEnvRegion = []string{
		"OS_REGION_NAME",
		"NOVA_REGION",
	}
	// CredEnvTenantName is used for Credentials.TenantName.
	CredEnvTenantName = []string{
		"OS_PROJECT_NAME",
		"OS_TENANT_NAME",
	}
	// CredEnvTenantID is used for Credentials.TenantID.
	CredEnvTenantID = []string{
		"OS_TENANT_ID",
		"OS_PROJECT_ID",
		"NOVA_PROJECT_ID",
	}
	// CredEnvVersion is used for Credentials.Version.
	CredEnvVersion = []string{
		"OS_AUTH_VERSION",
		"OS_IDENTITY_API_VERSION",
	}
	// The following env vars are set according to what type
	// of keystone v3 domain authorization is required.
	CredEnvDefaultDomainName = []string{
		"OS_DEFAULT_DOMAIN_NAME",
	}
	CredEnvProjectDomainName = []string{
		"OS_PROJECT_DOMAIN_NAME",
	}
	CredEnvUserDomainName = []string{
		"OS_USER_DOMAIN_NAME",
	}
	CredEnvDomainName = []string{
		"OS_DOMAIN_NAME",
	}
)

The following variables hold the names of environment variables that are used by CredentialsFromEnv to populate a Credentials value. The most preferred names are at the start of the slices.

Functions

This section is empty.

Types

type AuthDetails

type AuthDetails struct {
	Token             string
	TenantId          string
	TenantName        string
	UserId            string
	Domain            string
	RegionServiceURLs map[string]ServiceURLs // Service type to endpoint URLs for each region
}

AuthDetails defines all the necessary information, needed for an authenticated session with OpenStack.

type AuthMode

type AuthMode int

AuthMode defines the authentication method to use (see Auth* constants below).

func (AuthMode) String

func (a AuthMode) String() string

type AuthOption

type AuthOption struct {
	Mode     AuthMode
	Endpoint string
}

type AuthOptions

type AuthOptions []AuthOption

func FetchAuthOptions

func FetchAuthOptions(url string, client goosehttp.HttpClient, compatLogger logging.CompatLogger) (AuthOptions, error)

FetchAuthOptions returns the authentication options advertised by this openstack.

type Authenticator

type Authenticator interface {
	Auth(creds *Credentials) (*AuthDetails, error)
}

Authenticator is implemented by each authentication method.

func NewAuthenticator

func NewAuthenticator(authMode AuthMode, httpClient goosehttp.HttpClient) Authenticator

NewAuthenticator creates an authenticator matching the supplied AuthMode. The httpclient is allowed to be nil, the Authenticator will just use the default http.Client

type Credentials

type Credentials struct {
	URL           string // The URL to authenticate against
	User          string // The username to authenticate as
	Secrets       string // The secrets to pass
	Region        string // Region to send requests to
	TenantName    string `credentials:"optional"` // The project name for this connection
	TenantID      string `credentials:"optional"` // The project ID for this connection
	Version       int    `credentials:"optional"` // The Keystone version
	Domain        string `credentials:"optional"` // The domain for authorization (new in keystone v3)
	UserDomain    string `credentials:"optional"` // The owning domain for this user (new in keystone v3)
	ProjectDomain string `credentials:"optional"` // The project domain for authorization (new in keystone v3)
}

Credentials defines necessary parameters for authentication. TODO - Tenant is deprecated, migrate attribute names to Project.

func CompleteCredentialsFromEnv

func CompleteCredentialsFromEnv() (cred *Credentials, err error)

CompleteCredentialsFromEnv gets and verifies all the required authentication parameters have values in the environment.

func CredentialsFromEnv

func CredentialsFromEnv() (*Credentials, error)

CredentialsFromEnv creates and initializes the credentials from the environment variables.

type KeyPair

type KeyPair struct {
	// contains filtered or unexported fields
}

KeyPair allows OpenStack cloud authentication using an access and secret key.

It implements Authenticator interface by providing the Auth method.

func (*KeyPair) Auth

func (u *KeyPair) Auth(creds *Credentials) (*AuthDetails, error)

type Legacy

type Legacy struct {
	// contains filtered or unexported fields
}

func (*Legacy) Auth

func (l *Legacy) Auth(creds *Credentials) (*AuthDetails, error)

type ServiceURLs

type ServiceURLs map[string]string

type UserPass

type UserPass struct {
	// contains filtered or unexported fields
}

func (*UserPass) Auth

func (u *UserPass) Auth(creds *Credentials) (*AuthDetails, error)

type V3UserPass

type V3UserPass struct {
	// contains filtered or unexported fields
}

V3UserPass is an Authenticator that will perform username + password authentication using the v3 protocol.

func (*V3UserPass) Auth

func (u *V3UserPass) Auth(creds *Credentials) (*AuthDetails, error)

Auth performs a v3 username + password authentication request using the values supplied in creds.

Jump to

Keyboard shortcuts

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