go-autorest: github.com/Azure/go-autorest/autorest/azure/auth Index | Files

package auth

import "github.com/Azure/go-autorest/autorest/azure/auth"

Index

Package Files

auth.go

Constants

const (
    SubscriptionID          = "AZURE_SUBSCRIPTION_ID"
    TenantID                = "AZURE_TENANT_ID"
    AuxiliaryTenantIDs      = "AZURE_AUXILIARY_TENANT_IDS"
    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.

func NewAuthorizerFromCLI Uses

func NewAuthorizerFromCLI() (autorest.Authorizer, error)

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

func NewAuthorizerFromCLIWithResource Uses

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

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

func NewAuthorizerFromEnvironment Uses

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 Uses

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 Uses

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 Uses

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

type AuthorizerConfig Uses

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

AuthorizerConfig provides an authorizer from the configuration provided.

type ClientCertificateConfig Uses

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 Uses

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 Uses

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

Authorizer gets an authorizer object from client certificate.

func (ClientCertificateConfig) ServicePrincipalToken Uses

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

ServicePrincipalToken creates a ServicePrincipalToken from client certificate.

type ClientCredentialsConfig Uses

type ClientCredentialsConfig struct {
    ClientID     string
    ClientSecret string
    TenantID     string
    AuxTenants   []string
    AADEndpoint  string
    Resource     string
}

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

func NewClientCredentialsConfig Uses

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 Uses

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

Authorizer gets the authorizer from client credentials.

func (ClientCredentialsConfig) MultiTenantServicePrincipalToken Uses

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

MultiTenantServicePrincipalToken creates a MultiTenantServicePrincipalToken from client credentials.

func (ClientCredentialsConfig) ServicePrincipalToken Uses

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

ServicePrincipalToken creates a ServicePrincipalToken from client credentials.

type DeviceFlowConfig Uses

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 Uses

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 Uses

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

Authorizer gets the authorizer from device flow.

func (DeviceFlowConfig) ServicePrincipalToken Uses

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

ServicePrincipalToken gets the service principal token from device flow.

type EnvironmentSettings Uses

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

EnvironmentSettings contains the available authentication settings.

func GetSettingsFromEnvironment Uses

func GetSettingsFromEnvironment() (s EnvironmentSettings, err error)

GetSettingsFromEnvironment returns the available authentication settings from the environment.

func (EnvironmentSettings) GetAuthorizer Uses

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 Uses

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 Uses

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 Uses

func (settings EnvironmentSettings) GetDeviceFlow() DeviceFlowConfig

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

func (EnvironmentSettings) GetMSI Uses

func (settings EnvironmentSettings) GetMSI() MSIConfig

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

func (EnvironmentSettings) GetSubscriptionID Uses

func (settings EnvironmentSettings) GetSubscriptionID() string

GetSubscriptionID returns the available subscription ID or an empty string.

func (EnvironmentSettings) GetUsernamePassword Uses

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 Uses

type FileSettings struct {
    Values map[string]string
}

FileSettings contains the available authentication settings.

func GetSettingsFromFile Uses

func GetSettingsFromFile() (FileSettings, error)

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

func (FileSettings) ClientCertificateAuthorizer Uses

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

ClientCertificateAuthorizer creates an authorizer from the available certificate credentials.

func (FileSettings) ClientCertificateAuthorizerWithResource Uses

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 Uses

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

ClientCredentialsAuthorizer creates an authorizer from the available client credentials.

func (FileSettings) ClientCredentialsAuthorizerWithResource Uses

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 Uses

func (settings FileSettings) GetSubscriptionID() string

GetSubscriptionID returns the available subscription ID or an empty string.

func (FileSettings) ServicePrincipalTokenFromClientCertificate Uses

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

ServicePrincipalTokenFromClientCertificate creates a ServicePrincipalToken from the available certificate credentials.

func (FileSettings) ServicePrincipalTokenFromClientCertificateWithResource Uses

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

ServicePrincipalTokenFromClientCertificateWithResource creates a ServicePrincipalToken from the available certificate credentials.

func (FileSettings) ServicePrincipalTokenFromClientCredentials Uses

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

ServicePrincipalTokenFromClientCredentials creates a ServicePrincipalToken from the available client credentials.

func (FileSettings) ServicePrincipalTokenFromClientCredentialsWithResource Uses

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

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

type MSIConfig Uses

type MSIConfig struct {
    Resource string
    ClientID string
}

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

func NewMSIConfig Uses

func NewMSIConfig() MSIConfig

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

func (MSIConfig) Authorizer Uses

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

Authorizer gets the authorizer from MSI.

type UsernamePasswordConfig Uses

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 Uses

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 Uses

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

Authorizer gets the authorizer from a username and a password.

func (UsernamePasswordConfig) ServicePrincipalToken Uses

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

ServicePrincipalToken creates a ServicePrincipalToken from username and password.

Package auth imports 18 packages (graph) and is imported by 59 packages. Updated 2019-08-19. Refresh now. Tools for package owners.