Documentation
¶
Index ¶
- Constants
- func NewTokenCredential(ctx context.Context, opts ...auth.Option) azcore.TokenCredential
- type AKSClient
- type AccessToken
- type Implementation
- type Provider
- func (p Provider) GetAccessCredentialOptionsForArtifactRepository(artifactRepository string, _ ...auth.Option) ([]auth.Option, error)
- func (Provider) GetAccessCredentialOptionsForCluster(opts ...auth.Option) ([][]auth.Option, error)
- func (Provider) GetAccessCredentialOptionsForGitRepository(*url.URL) ([]auth.Option, error)
- func (Provider) GetAudiences(_ context.Context, opts ...auth.Option) ([]string, error)
- func (Provider) GetIdentity(opts ...auth.Option) (string, error)
- func (Provider) GetName() string
- func (p Provider) NewAccessCredentialForIdentity(ctx context.Context, identity auth.Credential, opts ...auth.Option) (auth.Credential, error)
- func (p Provider) NewArtifactRegistryCredentials(ctx context.Context, registry string, accessCredential auth.Credential, ...) (*auth.ArtifactRegistryCredentials, error)
- func (p Provider) NewControllerToken(ctx context.Context, opts ...auth.Option) (auth.Credential, error)
- func (Provider) NewGitCredentials(_ context.Context, _ string, accessCredential auth.Credential, ...) (*auth.GitCredentials, error)
- func (p Provider) NewRESTConfig(ctx context.Context, accessCredentials []auth.Credential, opts ...auth.Option) (*auth.RESTConfig, error)
- func (Provider) ParseArtifactRepository(artifactRepository string) (string, error)
- func (Provider) ParseGitRepository(*url.URL) (string, error)
Constants ¶
const ( // https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/service-principal-managed-identity?view=azure-devops#q-can-i-add-a-managed-identity-from-a-different-tenant-to-my-organization ScopeDevOps = "499b84ac-1321-427f-aa17-267ca6975798/.default" // https://github.com/Azure/azure-sdk-for-go/blob/f5dfe3b53fe63aacd3aeba948bbe21d961edf376/sdk/storage/azqueue/internal/shared/shared.go#L18 ScopeBlobStorage = "https://storage.azure.com/.default" // https://github.com/Azure/azure-sdk-for-go/blob/f5dfe3b53fe63aacd3aeba948bbe21d961edf376/sdk/messaging/azeventhubs/internal/sbauth/token_provider.go#L99 ScopeEventHubs = "https://eventhubs.azure.net//.default" )
const ProviderName = "azure"
ProviderName is the name of the Azure authentication provider.
Variables ¶
This section is empty.
Functions ¶
func NewTokenCredential ¶ added in v0.11.0
NewTokenCredential creates a new token credential for the given options.
Types ¶
type AKSClient ¶ added in v0.21.0
type AKSClient interface {
Get(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientGetOptions) (armcontainerservice.ManagedClustersClientGetResponse, error)
ListClusterUserCredentials(ctx context.Context, resourceGroupName string, resourceName string, options *armcontainerservice.ManagedClustersClientListClusterUserCredentialsOptions) (armcontainerservice.ManagedClustersClientListClusterUserCredentialsResponse, error)
}
AKSClient provides the required methods of the AKS client.
type AccessToken ¶ added in v0.64.0
type AccessToken struct{ azcore.AccessToken }
AccessToken is the Azure access token.
func (*AccessToken) GetDuration ¶ added in v0.64.0
func (t *AccessToken) GetDuration() time.Duration
GetDuration implements auth.Credential.
type Implementation ¶ added in v0.11.0
type Implementation interface {
NewDefaultAzureCredential(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error)
NewDefaultAzureCredentialWithoutShellOut(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error)
NewClientAssertionCredential(tenantID string, clientID string, getAssertion func(context.Context) (string, error), options *azidentity.ClientAssertionCredentialOptions) (azcore.TokenCredential, error)
ExchangeAADAccessTokenForACRRefreshToken(ctx context.Context, client *azcontainerregistry.AuthenticationClient, grantType azcontainerregistry.PostContentSchemaGrantType, service string, options *azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenOptions) (azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenResponse, error)
NewManagedClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (AKSClient, error)
}
Implementation provides the required methods of the Azure libraries.
type Provider ¶ added in v0.11.0
type Provider struct{ Implementation }
Provider implements the auth.Provider interface for Azure authentication.
func (Provider) GetAccessCredentialOptionsForArtifactRepository ¶ added in v0.64.0
func (p Provider) GetAccessCredentialOptionsForArtifactRepository(artifactRepository string, _ ...auth.Option) ([]auth.Option, error)
GetAccessCredentialOptionsForArtifactRepository implements auth.Provider.
func (Provider) GetAccessCredentialOptionsForCluster ¶ added in v0.64.0
GetAccessCredentialOptionsForCluster implements auth.Provider.
func (Provider) GetAccessCredentialOptionsForGitRepository ¶ added in v0.64.0
GetAccessCredentialOptionsForGitRepository implements auth.GitCredentialsProvider. Azure DevOps requires the DevOps scope for obtaining an access credential that can be used as a bearer token against Azure Repos.
func (Provider) GetAudiences ¶ added in v0.21.0
GetAudiences implements auth.Provider.
func (Provider) GetIdentity ¶ added in v0.11.0
GetIdentity implements auth.Provider.
func (Provider) NewAccessCredentialForIdentity ¶ added in v0.64.0
func (p Provider) NewAccessCredentialForIdentity(ctx context.Context, identity auth.Credential, opts ...auth.Option) (auth.Credential, error)
NewAccessCredentialForIdentity implements auth.Provider.
func (Provider) NewArtifactRegistryCredentials ¶ added in v0.12.0
func (p Provider) NewArtifactRegistryCredentials(ctx context.Context, registry string, accessCredential auth.Credential, opts ...auth.Option) (*auth.ArtifactRegistryCredentials, error)
NewArtifactRegistryCredentials implements auth.Provider.
func (Provider) NewControllerToken ¶ added in v0.12.0
func (p Provider) NewControllerToken(ctx context.Context, opts ...auth.Option) (auth.Credential, error)
NewControllerToken implements auth.Provider.
func (Provider) NewGitCredentials ¶ added in v0.42.0
func (Provider) NewGitCredentials(_ context.Context, _ string, accessCredential auth.Credential, _ ...auth.Option) (*auth.GitCredentials, error)
NewGitCredentials implements auth.GitCredentialsProvider.
func (Provider) NewRESTConfig ¶ added in v0.21.0
func (p Provider) NewRESTConfig(ctx context.Context, accessCredentials []auth.Credential, opts ...auth.Option) (*auth.RESTConfig, error)
NewRESTConfig implements auth.Provider.
func (Provider) ParseArtifactRepository ¶ added in v0.12.0
ParseArtifactRepository implements auth.Provider. ParseArtifactRepository returns the ACR registry host.
func (Provider) ParseGitRepository ¶ added in v0.42.0
ParseGitRepository implements auth.GitCredentialsProvider. Azure DevOps access credentials are not bound to the Git repository URL, so this returns a constant input that does not affect the cache key.