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 ¶
func (c *UCPCredential) GetToken(ctx context.Context, opts policy.TokenRequestOptions) (azcore.AccessToken, error)
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.
Click to show internal directories.
Click to hide internal directories.