auth

package
v11.7.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SubscriptionID          = "AZURE_SUBSCRIPTION_ID"
	TenantID                = "AZURE_TENANT_ID"
	ClientID                = "AZURE_CLIENT_ID"
	ClientSecret            = "AZURE_CLIENT_SECRET"
	CertificatePath         = "AZURE_CERTIFICATE_PATH"
	CertificatePassword     = "AZURE_CERTIFICATE_PASSWORD"
	Username                = "AZURE_USERNAME"
	Password                = "AZURE_PASSWORD"
	EnvironmentName         = "AZURE_ENVIRONMENT"
	Resource                = "AZURE_AD_RESOURCE"
	ActiveDirectoryEndpoint = "ActiveDirectoryEndpoint"
	ResourceManagerEndpoint = "ResourceManagerEndpoint"
	GraphResourceID         = "GraphResourceID"
	SQLManagementEndpoint   = "SQLManagementEndpoint"
	GalleryEndpoint         = "GalleryEndpoint"
	ManagementEndpoint      = "ManagementEndpoint"
)

The possible keys in the Values map.

Variables

This section is empty.

Functions

func NewAuthorizerFromCLI

func NewAuthorizerFromCLI() (autorest.Authorizer, error)

NewAuthorizerFromCLI creates an Authorizer configured from Azure CLI 2.0 for local development scenarios.

func NewAuthorizerFromCLIWithResource

func NewAuthorizerFromCLIWithResource(resource string) (autorest.Authorizer, error)

NewAuthorizerFromCLIWithResource creates an Authorizer configured from Azure CLI 2.0 for local development scenarios.

func NewAuthorizerFromEnvironment

func NewAuthorizerFromEnvironment() (autorest.Authorizer, error)

NewAuthorizerFromEnvironment creates an Authorizer configured from environment variables in the order: 1. Client credentials 2. Client certificate 3. Username password 4. MSI

func NewAuthorizerFromEnvironmentWithResource

func NewAuthorizerFromEnvironmentWithResource(resource string) (autorest.Authorizer, error)

NewAuthorizerFromEnvironmentWithResource creates an Authorizer configured from environment variables in the order: 1. Client credentials 2. Client certificate 3. Username password 4. MSI

func NewAuthorizerFromFile

func NewAuthorizerFromFile(baseURI string) (autorest.Authorizer, error)

NewAuthorizerFromFile creates an Authorizer configured from a configuration file in the following order. 1. Client credentials 2. Client certificate

func NewAuthorizerFromFileWithResource

func NewAuthorizerFromFileWithResource(resource string) (autorest.Authorizer, error)

NewAuthorizerFromFileWithResource creates an Authorizer configured from a configuration file in the following order. 1. Client credentials 2. Client certificate

Types

type AuthorizerConfig

type AuthorizerConfig interface {
	Authorizer() (autorest.Authorizer, error)
}

AuthorizerConfig provides an authorizer from the configuration provided.

type ClientCertificateConfig

type ClientCertificateConfig struct {
	ClientID            string
	CertificatePath     string
	CertificatePassword string
	TenantID            string
	AADEndpoint         string
	Resource            string
}

ClientCertificateConfig provides the options to get a bearer authorizer from a client certificate.

func NewClientCertificateConfig

func NewClientCertificateConfig(certificatePath string, certificatePassword string, clientID string, tenantID string) ClientCertificateConfig

NewClientCertificateConfig creates a ClientCertificateConfig object configured to obtain an Authorizer through client certificate. Defaults to Public Cloud and Resource Manager Endpoint.

func (ClientCertificateConfig) Authorizer

func (ccc ClientCertificateConfig) Authorizer() (autorest.Authorizer, error)

Authorizer gets an authorizer object from client certificate.

func (ClientCertificateConfig) ServicePrincipalToken

func (ccc ClientCertificateConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error)

ServicePrincipalToken creates a ServicePrincipalToken from client certificate.

type ClientCredentialsConfig

type ClientCredentialsConfig struct {
	ClientID     string
	ClientSecret string
	TenantID     string
	AADEndpoint  string
	Resource     string
}

ClientCredentialsConfig provides the options to get a bearer authorizer from client credentials.

func NewClientCredentialsConfig

func NewClientCredentialsConfig(clientID string, clientSecret string, tenantID string) ClientCredentialsConfig

NewClientCredentialsConfig creates an AuthorizerConfig object configured to obtain an Authorizer through Client Credentials. Defaults to Public Cloud and Resource Manager Endpoint.

func (ClientCredentialsConfig) Authorizer

func (ccc ClientCredentialsConfig) Authorizer() (autorest.Authorizer, error)

Authorizer gets the authorizer from client credentials.

func (ClientCredentialsConfig) ServicePrincipalToken

func (ccc ClientCredentialsConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error)

ServicePrincipalToken creates a ServicePrincipalToken from client credentials.

type DeviceFlowConfig

type DeviceFlowConfig struct {
	ClientID    string
	TenantID    string
	AADEndpoint string
	Resource    string
}

DeviceFlowConfig provides the options to get a bearer authorizer using device flow authentication.

func NewDeviceFlowConfig

func NewDeviceFlowConfig(clientID string, tenantID string) DeviceFlowConfig

NewDeviceFlowConfig creates a DeviceFlowConfig object configured to obtain an Authorizer through device flow. Defaults to Public Cloud and Resource Manager Endpoint.

func (DeviceFlowConfig) Authorizer

func (dfc DeviceFlowConfig) Authorizer() (autorest.Authorizer, error)

Authorizer gets the authorizer from device flow.

func (DeviceFlowConfig) ServicePrincipalToken

func (dfc DeviceFlowConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error)

ServicePrincipalToken gets the service principal token from device flow.

type EnvironmentSettings

type EnvironmentSettings struct {
	Values      map[string]string
	Environment azure.Environment
}

EnvironmentSettings contains the available authentication settings.

func GetSettingsFromEnvironment

func GetSettingsFromEnvironment() (s EnvironmentSettings, err error)

GetSettingsFromEnvironment returns the available authentication settings from the environment.

func (EnvironmentSettings) GetAuthorizer

func (settings EnvironmentSettings) GetAuthorizer() (autorest.Authorizer, error)

GetAuthorizer creates an Authorizer configured from environment variables in the order: 1. Client credentials 2. Client certificate 3. Username password 4. MSI

func (EnvironmentSettings) GetClientCertificate

func (settings EnvironmentSettings) GetClientCertificate() (ClientCertificateConfig, error)

GetClientCertificate creates a config object from the available certificate credentials. An error is returned if no certificate credentials are available.

func (EnvironmentSettings) GetClientCredentials

func (settings EnvironmentSettings) GetClientCredentials() (ClientCredentialsConfig, error)

GetClientCredentials creates a config object from the available client credentials. An error is returned if no client credentials are available.

func (EnvironmentSettings) GetDeviceFlow

func (settings EnvironmentSettings) GetDeviceFlow() DeviceFlowConfig

GetDeviceFlow creates a device-flow config object from the available client and tenant IDs.

func (EnvironmentSettings) GetMSI

func (settings EnvironmentSettings) GetMSI() MSIConfig

GetMSI creates a MSI config object from the available client ID.

func (EnvironmentSettings) GetSubscriptionID

func (settings EnvironmentSettings) GetSubscriptionID() string

GetSubscriptionID returns the available subscription ID or an empty string.

func (EnvironmentSettings) GetUsernamePassword

func (settings EnvironmentSettings) GetUsernamePassword() (UsernamePasswordConfig, error)

GetUsernamePassword creates a config object from the available username/password credentials. An error is returned if no username/password credentials are available.

type FileSettings

type FileSettings struct {
	Values map[string]string
}

FileSettings contains the available authentication settings.

func GetSettingsFromFile

func GetSettingsFromFile() (FileSettings, error)

GetSettingsFromFile returns the available authentication settings from an Azure CLI authentication file.

func (FileSettings) ClientCertificateAuthorizer

func (settings FileSettings) ClientCertificateAuthorizer(baseURI string) (autorest.Authorizer, error)

ClientCertificateAuthorizer creates an authorizer from the available certificate credentials.

func (FileSettings) ClientCertificateAuthorizerWithResource

func (settings FileSettings) ClientCertificateAuthorizerWithResource(resource string) (autorest.Authorizer, error)

ClientCertificateAuthorizerWithResource creates an authorizer from the available certificate credentials and the specified resource.

func (FileSettings) ClientCredentialsAuthorizer

func (settings FileSettings) ClientCredentialsAuthorizer(baseURI string) (autorest.Authorizer, error)

ClientCredentialsAuthorizer creates an authorizer from the available client credentials.

func (FileSettings) ClientCredentialsAuthorizerWithResource

func (settings FileSettings) ClientCredentialsAuthorizerWithResource(resource string) (autorest.Authorizer, error)

ClientCredentialsAuthorizerWithResource creates an authorizer from the available client credentials and the specified resource.

func (FileSettings) GetSubscriptionID

func (settings FileSettings) GetSubscriptionID() string

GetSubscriptionID returns the available subscription ID or an empty string.

func (FileSettings) ServicePrincipalTokenFromClientCertificate

func (settings FileSettings) ServicePrincipalTokenFromClientCertificate(baseURI string) (*adal.ServicePrincipalToken, error)

ServicePrincipalTokenFromClientCertificate creates a ServicePrincipalToken from the available certificate credentials.

func (FileSettings) ServicePrincipalTokenFromClientCertificateWithResource

func (settings FileSettings) ServicePrincipalTokenFromClientCertificateWithResource(resource string) (*adal.ServicePrincipalToken, error)

ServicePrincipalTokenFromClientCertificateWithResource creates a ServicePrincipalToken from the available certificate credentials.

func (FileSettings) ServicePrincipalTokenFromClientCredentials

func (settings FileSettings) ServicePrincipalTokenFromClientCredentials(baseURI string) (*adal.ServicePrincipalToken, error)

ServicePrincipalTokenFromClientCredentials creates a ServicePrincipalToken from the available client credentials.

func (FileSettings) ServicePrincipalTokenFromClientCredentialsWithResource

func (settings FileSettings) ServicePrincipalTokenFromClientCredentialsWithResource(resource string) (*adal.ServicePrincipalToken, error)

ServicePrincipalTokenFromClientCredentialsWithResource creates a ServicePrincipalToken from the available client credentials and the specified resource.

type MSIConfig

type MSIConfig struct {
	Resource string
	ClientID string
}

MSIConfig provides the options to get a bearer authorizer through MSI.

func NewMSIConfig

func NewMSIConfig() MSIConfig

NewMSIConfig creates an MSIConfig object configured to obtain an Authorizer through MSI.

func (MSIConfig) Authorizer

func (mc MSIConfig) Authorizer() (autorest.Authorizer, error)

Authorizer gets the authorizer from MSI.

type UsernamePasswordConfig

type UsernamePasswordConfig struct {
	ClientID    string
	Username    string
	Password    string
	TenantID    string
	AADEndpoint string
	Resource    string
}

UsernamePasswordConfig provides the options to get a bearer authorizer from a username and a password.

func NewUsernamePasswordConfig

func NewUsernamePasswordConfig(username string, password string, clientID string, tenantID string) UsernamePasswordConfig

NewUsernamePasswordConfig creates an UsernamePasswordConfig object configured to obtain an Authorizer through username and password. Defaults to Public Cloud and Resource Manager Endpoint.

func (UsernamePasswordConfig) Authorizer

func (ups UsernamePasswordConfig) Authorizer() (autorest.Authorizer, error)

Authorizer gets the authorizer from a username and a password.

func (UsernamePasswordConfig) ServicePrincipalToken

func (ups UsernamePasswordConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error)

ServicePrincipalToken creates a ServicePrincipalToken from username and password.

Jump to

Keyboard shortcuts

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