tokenprovider

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClientAssertionCredentialOptions

func GetClientAssertionCredentialOptions() *azidentity.ClientAssertionCredentialOptions

func GetClientSecret

func GetClientSecret(ctx context.Context, cl client.Client, secretRef *corev1.SecretReference) (string, error)

GetClientSecret retrieves the client secret from a Kubernetes secret.

func GetClientSecretCredentialOptions

func GetClientSecretCredentialOptions() *azidentity.ClientSecretCredentialOptions

Types

type TokenExpiry

type TokenExpiry struct {
	Token     string    // The token string.
	ExpiresAt time.Time // The expiration time of the token.
}

TokenExpiry represents a token and its expiration time.

type TokenProvider

type TokenProvider interface {
	// GetToken retrieves a token and its expiration time.
	GetToken(ctx context.Context) (TokenExpiry, error)
}

TokenProvider is an interface for retrieving tokens.

func NewAzureClientSecretTokenProvider

func NewAzureClientSecretTokenProvider(tenantID, clientID, clientSecret string, tokenOption policy.TokenRequestOptions) (TokenProvider, error)

NewAzureClientSecretTokenProvider creates a new TokenProvider with the given tenant ID, client ID, client secret, and token request options.

func NewAzureTokenProvider

func NewAzureTokenProvider(_ context.Context, tenantID, clientID string, tokenProvider TokenProvider, tokenOption policy.TokenRequestOptions) (TokenProvider, error)

NewAzureTokenProvider creates a new TokenProvider with the given tenant ID, client ID, tokenProvider, and token request options.

func NewGCPTokenProvider added in v0.3.0

func NewGCPTokenProvider(ctx context.Context, gcpCredentialLiteral []byte) (TokenProvider, error)

NewGCPTokenProvider creates a new TokenProvider with GCP service account key JSON string.

func NewMockTokenProvider

func NewMockTokenProvider(mockToken string, mockExpireAt time.Time, err error) TokenProvider

NewMockTokenProvider creates a new MockTokenProvider with the given token, expiration time, and error.

func NewOidcTokenProvider

func NewOidcTokenProvider(ctx context.Context, client client.Client, oidcConfig *egv1a1.OIDC) (TokenProvider, error)

NewOidcTokenProvider creates a new TokenProvider with the given OIDC configuration.

Jump to

Keyboard shortcuts

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