credential

package
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultExpireDuration is the default expiry duration.
	DefaultExpireDuration = time.Second * time.Duration(30)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type UCPCredential

type UCPCredential struct {
	// contains filtered or unexported fields
}

UCPCredential authenticates service principal using UCP credential APIs.

func NewUCPCredential

func NewUCPCredential(options UCPCredentialOptions) (*UCPCredential, error)

NewUCPCredential creates a new UCPCredential with the given options and returns it, or returns an error if the provider is not defined. If Duration is 0, it is set to DefaultDuration. Pass nil to accept default options.

func (*UCPCredential) GetToken

GetToken attempts to refresh the Azure credential if it is expired and then returns an access token if the credential is ready. This method is called automatically by Azure SDK clients.

type UCPCredentialOptions

type UCPCredentialOptions struct {
	// Provider is an UCP credential provider.
	Provider sdk_cred.CredentialProvider[sdk_cred.AzureCredential]
	// Duration is the duration to refresh token client.
	Duration time.Duration

	// ClientOptions is the options for azure client.
	ClientOptions *azcore.ClientOptions

	// TokenFilePath is the path to the azure token file (for use with Azure workload identity)
	TokenFilePath string
}

UCPCredentialOptions is the options for UCP credential.

Jump to

Keyboard shortcuts

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