package credproviders
import "go.mongodb.org/mongo-driver/internal/credproviders"
Index ¶
- Constants
- type AssumeRoleProvider
- func NewAssumeRoleProvider(httpClient *http.Client, expiryWindow time.Duration) *AssumeRoleProvider
- func (a *AssumeRoleProvider) IsExpired() bool
- func (a *AssumeRoleProvider) Retrieve() (credentials.Value, error)
- func (a *AssumeRoleProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
- type AzureProvider
- func NewAzureProvider(httpClient *http.Client, expiryWindow time.Duration) *AzureProvider
- func (a *AzureProvider) IsExpired() bool
- func (a *AzureProvider) Retrieve() (credentials.Value, error)
- func (a *AzureProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
- type EC2Provider
- func NewEC2Provider(httpClient *http.Client, expiryWindow time.Duration) *EC2Provider
- func (e *EC2Provider) IsExpired() bool
- func (e *EC2Provider) Retrieve() (credentials.Value, error)
- func (e *EC2Provider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
- type ECSProvider
- func NewECSProvider(httpClient *http.Client, expiryWindow time.Duration) *ECSProvider
- func (e *ECSProvider) IsExpired() bool
- func (e *ECSProvider) Retrieve() (credentials.Value, error)
- func (e *ECSProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
- type EnvProvider
- func NewEnvProvider() *EnvProvider
- func (e *EnvProvider) IsExpired() bool
- func (e *EnvProvider) Retrieve() (credentials.Value, error)
- type EnvVar
- type StaticProvider
Constants ¶
const ( // AzureProviderName provides a name of Azure provider AzureProviderName = "AzureProvider" )
Types ¶
type AssumeRoleProvider ¶
type AssumeRoleProvider struct { AwsRoleArnEnv EnvVar AwsWebIdentityTokenFileEnv EnvVar AwsRoleSessionNameEnv EnvVar // contains filtered or unexported fields }
An AssumeRoleProvider retrieves credentials for assume role with web identity.
func NewAssumeRoleProvider ¶
func NewAssumeRoleProvider(httpClient *http.Client, expiryWindow time.Duration) *AssumeRoleProvider
NewAssumeRoleProvider returns a pointer to an assume role provider.
func (*AssumeRoleProvider) IsExpired ¶
func (a *AssumeRoleProvider) IsExpired() bool
IsExpired returns true if the credentials are expired.
func (*AssumeRoleProvider) Retrieve ¶
func (a *AssumeRoleProvider) Retrieve() (credentials.Value, error)
Retrieve retrieves the keys from the AWS service.
func (*AssumeRoleProvider) RetrieveWithContext ¶
func (a *AssumeRoleProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
RetrieveWithContext retrieves the keys from the AWS service.
type AzureProvider ¶
type AzureProvider struct {
// contains filtered or unexported fields
}
An AzureProvider retrieves credentials from Azure IMDS.
func NewAzureProvider ¶
func NewAzureProvider(httpClient *http.Client, expiryWindow time.Duration) *AzureProvider
NewAzureProvider returns a pointer to an Azure credential provider.
func (*AzureProvider) IsExpired ¶
func (a *AzureProvider) IsExpired() bool
IsExpired returns if the credentials have been retrieved.
func (*AzureProvider) Retrieve ¶
func (a *AzureProvider) Retrieve() (credentials.Value, error)
Retrieve retrieves the keys from the Azure service.
func (*AzureProvider) RetrieveWithContext ¶
func (a *AzureProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
RetrieveWithContext retrieves the keys from the Azure service.
type EC2Provider ¶
type EC2Provider struct {
// contains filtered or unexported fields
}
An EC2Provider retrieves credentials from EC2 metadata.
func NewEC2Provider ¶
func NewEC2Provider(httpClient *http.Client, expiryWindow time.Duration) *EC2Provider
NewEC2Provider returns a pointer to an EC2 credential provider.
func (*EC2Provider) IsExpired ¶
func (e *EC2Provider) IsExpired() bool
IsExpired returns true if the credentials are expired.
func (*EC2Provider) Retrieve ¶
func (e *EC2Provider) Retrieve() (credentials.Value, error)
Retrieve retrieves the keys from the AWS service.
func (*EC2Provider) RetrieveWithContext ¶
func (e *EC2Provider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
RetrieveWithContext retrieves the keys from the AWS service.
type ECSProvider ¶
type ECSProvider struct { AwsContainerCredentialsRelativeURIEnv EnvVar // contains filtered or unexported fields }
An ECSProvider retrieves credentials from ECS metadata.
func NewECSProvider ¶
func NewECSProvider(httpClient *http.Client, expiryWindow time.Duration) *ECSProvider
NewECSProvider returns a pointer to an ECS credential provider.
func (*ECSProvider) IsExpired ¶
func (e *ECSProvider) IsExpired() bool
IsExpired returns true if the credentials are expired.
func (*ECSProvider) Retrieve ¶
func (e *ECSProvider) Retrieve() (credentials.Value, error)
Retrieve retrieves the keys from the AWS service.
func (*ECSProvider) RetrieveWithContext ¶
func (e *ECSProvider) RetrieveWithContext(ctx context.Context) (credentials.Value, error)
RetrieveWithContext retrieves the keys from the AWS service.
type EnvProvider ¶
type EnvProvider struct { AwsAccessKeyIDEnv EnvVar AwsSecretAccessKeyEnv EnvVar AwsSessionTokenEnv EnvVar // contains filtered or unexported fields }
A EnvProvider retrieves credentials from the environment variables of the running process. Environment credentials never expire.
func NewEnvProvider ¶
func NewEnvProvider() *EnvProvider
NewEnvProvider returns a pointer to an ECS credential provider.
func (*EnvProvider) IsExpired ¶
func (e *EnvProvider) IsExpired() bool
IsExpired returns true if the credentials have not been retrieved.
func (*EnvProvider) Retrieve ¶
func (e *EnvProvider) Retrieve() (credentials.Value, error)
Retrieve retrieves the keys from the environment.
type EnvVar ¶
type EnvVar string
EnvVar is an environment variable
func (EnvVar) Get ¶
Get retrieves the environment variable
type StaticProvider ¶
type StaticProvider struct { credentials.Value // contains filtered or unexported fields }
A StaticProvider is a set of credentials which are set programmatically, and will never expire.
func (*StaticProvider) IsExpired ¶
func (s *StaticProvider) IsExpired() bool
IsExpired returns if the credentials are expired.
For StaticProvider, the credentials never expired.
func (*StaticProvider) Retrieve ¶
func (s *StaticProvider) Retrieve() (credentials.Value, error)
Retrieve returns the credentials or error if the credentials are invalid.
Source Files ¶
assume_role_provider.go ec2_provider.go ecs_provider.go env_provider.go imds_provider.go static_provider.go
- Version
- v1.17.3 (latest)
- Published
- Feb 25, 2025
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 16 hours ago –
Tools for package owners.