Documentation
¶
Index ¶
- type Authorizer
- func NewAzureCliAuthorizer(ctx context.Context, tenantId string) (Authorizer, error)
- func NewClientCertificateAuthorizer(ctx context.Context, environment environments.Environment, ...) (Authorizer, error)
- func NewClientSecretAuthorizer(ctx context.Context, environment environments.Environment, ...) (Authorizer, error)
- type AzureCliAuthorizer
- type AzureCliConfig
- type Claims
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorizer ¶
Authorizer is anything that can return an access token for authorizing API connections
func NewAzureCliAuthorizer ¶
func NewAzureCliAuthorizer(ctx context.Context, tenantId string) (Authorizer, error)
NewAzureCliAuthorizer returns an Authorizer which authenticates using the Azure CLI.
func NewClientCertificateAuthorizer ¶
func NewClientCertificateAuthorizer(ctx context.Context, environment environments.Environment, tenantId, clientId, pfxPath, pfxPass string) (Authorizer, error)
NewClientCertificateAuthorizer returns an authorizer which uses client certificate authentication.
func NewClientSecretAuthorizer ¶
func NewClientSecretAuthorizer(ctx context.Context, environment environments.Environment, tenantId, clientId, clientSecret string) (Authorizer, error)
NewClientSecretAuthorizer returns an authorizer which uses client secret authentication.
type AzureCliAuthorizer ¶
type AzureCliAuthorizer struct {
// TenantID is optional and forces selection of the specified tenant. Must be a valid UUID.
TenantID string
// contains filtered or unexported fields
}
AzureCliAuthorizer is an Authorizer which supports the Azure CLI.
type AzureCliConfig ¶
type AzureCliConfig struct {
TenantID string
}
AzureCliConfig configures an AzureCliAuthorizer.
func NewAzureCliConfig ¶
func NewAzureCliConfig(tenantId string) (*AzureCliConfig, error)
NewAzureCliConfig validates the supplied tenant ID and returns a new AzureCliConfig.
func (*AzureCliConfig) TokenSource ¶
func (c *AzureCliConfig) TokenSource(ctx context.Context) Authorizer
TokenSource provides a source for obtaining access tokens using AzureCliAuthorizer.
type Claims ¶
type Claims struct {
Audience string `json:"aud"`
Issuer string `json:"iss"`
IdentityProvider string `json:"idp"`
ObjectId string `json:"oid"`
Roles []string `json:"roles"`
Subject string `json:"sub"`
TenantRegionScope string `json:"tenant_region_scope"`
TenantId string `json:"tid"`
Version string `json:"ver"`
AppDisplayName string `json:"app_displayname,omitempty"`
AppId string `json:"appid,omitempty"`
IdType string `json:"idtyp,omitempty"`
}
Claims is used to unmarshall the claims from a JWT issued by the Microsoft Identity Platform.
type Config ¶
type Config struct {
// Specifies the national cloud environment to use
Environment environments.Environment
// Azure Active Directory tenant to connect to, should be a valid UUID
TenantID string
// Client ID for the application used to authenticate the connection
ClientID string
// Enables authentication using Azure CLI
EnableAzureCliToken bool
// Enables authentication using managed service identity. Not yet supported.
// TODO: NOT YET SUPPORTED
EnableMsiAuth bool
// Specifies a custom MSI endpoint to connect to
MsiEndpoint string
// Enables client certificate authentication using client assertions
EnableClientCertAuth bool
// Specifies the path to a client certificate bundle in PFX format
ClientCertPath string
// Specifies the encryption password to unlock a client certificate
ClientCertPassword string
// Enables client secret authentication using client credentials
EnableClientSecretAuth bool
// Specifies the password to authenticate with using client secret authentication
ClientSecret string
}
func (*Config) NewAuthorizer ¶
func (c *Config) NewAuthorizer(ctx context.Context) (Authorizer, error)
NewAuthorizer returns a suitable Authorizer depending on what is defined in the Config Authorizers are selected for authentication methods in the following preferential order: - Client certificate authentication - Client secret authentication - Azure CLI authentication
Whether one of these is returned depends on whether it is enabled in the Config, and whether sufficient configuration fields are set to enable that authentication method.
For client certificate authentication, specify TenantID, ClientID and ClientCertPath. For client secret authentication, specify TenantID, ClientID and ClientSecret. Azure CLI authentication (if enabled) is used as a fallback mechanism.