Class TokenProvider
- Namespace
- Microsoft.Azure.ServiceBus.Primitives
- Assembly
- Microsoft.Azure.ServiceBus.dll
This abstract base class can be extended to implement additional token providers.
public abstract class TokenProvider : ITokenProvider
- Inheritance
-
TokenProvider
- Implements
- Derived
- Inherited Members
Constructors
TokenProvider()
protected TokenProvider()
Methods
CreateAadTokenProvider(AuthenticationContext, ClientAssertionCertificate)
Creates an Azure Active Directory token provider.
public static TokenProvider CreateAadTokenProvider(AuthenticationContext authContext, ClientAssertionCertificate clientAssertionCertificate)
Parameters
authContext
AuthenticationContextAuthenticationContext for AAD.
clientAssertionCertificate
ClientAssertionCertificateThe client assertion certificate credential.
Returns
- TokenProvider
The TokenProvider for returning Json web token.
CreateAadTokenProvider(AuthenticationContext, ClientCredential)
Creates an Azure Active Directory token provider.
public static TokenProvider CreateAadTokenProvider(AuthenticationContext authContext, ClientCredential clientCredential)
Parameters
authContext
AuthenticationContextAuthenticationContext for AAD.
clientCredential
ClientCredentialThe app credential.
Returns
- TokenProvider
The TokenProvider for returning Json web token.
CreateAadTokenProvider(AuthenticationContext, string, Uri, IPlatformParameters, UserIdentifier)
Creates an Azure Active Directory token provider.
public static TokenProvider CreateAadTokenProvider(AuthenticationContext authContext, string clientId, Uri redirectUri, IPlatformParameters platformParameters, UserIdentifier userIdentifier = null)
Parameters
authContext
AuthenticationContextAuthenticationContext for AAD.
clientId
stringClientId for AAD.
redirectUri
UriThe redirectUri on Client App.
platformParameters
IPlatformParametersPlatform parameters
userIdentifier
UserIdentifierUser Identifier
Returns
- TokenProvider
The TokenProvider for returning Json web token.
CreateManagedServiceIdentityTokenProvider()
Creates Azure Managed Service Identity token provider.
public static TokenProvider CreateManagedServiceIdentityTokenProvider()
Returns
- TokenProvider
The TokenProvider for returning Json web token.
CreateSharedAccessSignatureTokenProvider(string)
Construct a TokenProvider based on a sharedAccessSignature.
public static TokenProvider CreateSharedAccessSignatureTokenProvider(string sharedAccessSignature)
Parameters
sharedAccessSignature
stringThe shared access signature
Returns
- TokenProvider
A TokenProvider initialized with the shared access signature
CreateSharedAccessSignatureTokenProvider(string, string)
Construct a TokenProvider based on the provided Key Name and Shared Access Key.
public static TokenProvider CreateSharedAccessSignatureTokenProvider(string keyName, string sharedAccessKey)
Parameters
keyName
stringThe key name of the corresponding SharedAccessKeyAuthorizationRule.
sharedAccessKey
stringThe key associated with the SharedAccessKeyAuthorizationRule
Returns
- TokenProvider
A TokenProvider initialized with the provided RuleId and Password
CreateSharedAccessSignatureTokenProvider(string, string, TokenScope)
Construct a TokenProvider based on the provided Key Name and Shared Access Key.
public static TokenProvider CreateSharedAccessSignatureTokenProvider(string keyName, string sharedAccessKey, TokenScope tokenScope)
Parameters
keyName
stringThe key name of the corresponding SharedAccessKeyAuthorizationRule.
sharedAccessKey
stringThe key associated with the SharedAccessKeyAuthorizationRule
tokenScope
TokenScopeThe tokenScope of tokens to request.
Returns
- TokenProvider
A TokenProvider initialized with the provided RuleId and Password
CreateSharedAccessSignatureTokenProvider(string, string, TimeSpan)
Construct a TokenProvider based on the provided Key Name and Shared Access Key.
public static TokenProvider CreateSharedAccessSignatureTokenProvider(string keyName, string sharedAccessKey, TimeSpan tokenTimeToLive)
Parameters
keyName
stringThe key name of the corresponding SharedAccessKeyAuthorizationRule.
sharedAccessKey
stringThe key associated with the SharedAccessKeyAuthorizationRule
tokenTimeToLive
TimeSpanThe token time to live
Returns
- TokenProvider
A TokenProvider initialized with the provided RuleId and Password
CreateSharedAccessSignatureTokenProvider(string, string, TimeSpan, TokenScope)
Construct a TokenProvider based on the provided Key Name and Shared Access Key.
public static TokenProvider CreateSharedAccessSignatureTokenProvider(string keyName, string sharedAccessKey, TimeSpan tokenTimeToLive, TokenScope tokenScope)
Parameters
keyName
stringThe key name of the corresponding SharedAccessKeyAuthorizationRule.
sharedAccessKey
stringThe key associated with the SharedAccessKeyAuthorizationRule
tokenTimeToLive
TimeSpanThe token time to live
tokenScope
TokenScopeThe tokenScope of tokens to request.
Returns
- TokenProvider
A TokenProvider initialized with the provided RuleId and Password
GetTokenAsync(string, TimeSpan)
Gets a SecurityToken for the given audience and duration.
public abstract Task<SecurityToken> GetTokenAsync(string appliesTo, TimeSpan timeout)
Parameters
appliesTo
stringThe URI which the access token applies to
timeout
TimeSpanThe time span that specifies the timeout value for the message that gets the security token