Table of Contents

Class SharedAccessSignatureTokenProvider

Namespace
Microsoft.Azure.ServiceBus.Primitives
Assembly
Microsoft.Azure.ServiceBus.dll

The SharedAccessSignatureTokenProvider generates tokens using a shared access key or existing signature.

public class SharedAccessSignatureTokenProvider : TokenProvider, ITokenProvider
Inheritance
SharedAccessSignatureTokenProvider
Implements
Inherited Members

Constructors

SharedAccessSignatureTokenProvider(string, string, Func<string, byte[]>, TimeSpan, TokenScope)

protected SharedAccessSignatureTokenProvider(string keyName, string sharedAccessKey, Func<string, byte[]> customKeyEncoder, TimeSpan tokenTimeToLive, TokenScope tokenScope)

Parameters

keyName string
sharedAccessKey string
customKeyEncoder Func<string, byte[]>
tokenTimeToLive TimeSpan
tokenScope TokenScope

Methods

BuildSignature(string)

protected virtual string BuildSignature(string targetUri)

Parameters

targetUri string

Returns

string

GetTokenAsync(string, TimeSpan)

Gets a SecurityToken for the given audience and duration.

public override Task<SecurityToken> GetTokenAsync(string appliesTo, TimeSpan timeout)

Parameters

appliesTo string

The URI which the access token applies to. If SharedAccessSignatureTokenProvider is initiated with SASKeyName and SASKey, the token will be generated for this uri. If initiated with SASToken, then the value is ignored.

timeout TimeSpan

The timeout value for how long it takes to get the security token (not the token time to live). For SAS token, no asynchronous operation takes place and hence this timeout is ignored.

Returns

Task<SecurityToken>

SecurityToken

Remarks

This parameter timeout is here for compatibility, but is not currently used.