Bagikan melalui


DelegatedTokenCredential.Create Method

Definition

Overloads

Create(Func<TokenRequestContext,CancellationToken,AccessToken>)

Creates a static TokenCredential that accepts delegates which will produce an AccessToken.

Create(Func<TokenRequestContext,CancellationToken,AccessToken>, Func<TokenRequestContext,CancellationToken,ValueTask<AccessToken>>)

Creates a static TokenCredential that accepts delegates which will produce an AccessToken.

Create(Func<TokenRequestContext,CancellationToken,AccessToken>)

Source:
DelegatedTokenCredential.cs

Creates a static TokenCredential that accepts delegates which will produce an AccessToken.

public static Azure.Core.TokenCredential Create (Func<Azure.Core.TokenRequestContext,System.Threading.CancellationToken,Azure.Core.AccessToken> getToken);
static member Create : Func<Azure.Core.TokenRequestContext, System.Threading.CancellationToken, Azure.Core.AccessToken> -> Azure.Core.TokenCredential
Public Shared Function Create (getToken As Func(Of TokenRequestContext, CancellationToken, AccessToken)) As TokenCredential

Parameters

getToken
Func<TokenRequestContext,CancellationToken,AccessToken>

A delegate that returns an AccessToken.

Returns

Remarks

Typically, the TokenCredential created by this method is for use when you have already obtained an AccessToken from some other source and need a TokenCredential that will simply return that token. Because the static token can expire, the delegates offer a mechanism to handle AccessToken renewal.

Applies to

Create(Func<TokenRequestContext,CancellationToken,AccessToken>, Func<TokenRequestContext,CancellationToken,ValueTask<AccessToken>>)

Source:
DelegatedTokenCredential.cs

Creates a static TokenCredential that accepts delegates which will produce an AccessToken.

public static Azure.Core.TokenCredential Create (Func<Azure.Core.TokenRequestContext,System.Threading.CancellationToken,Azure.Core.AccessToken> getToken, Func<Azure.Core.TokenRequestContext,System.Threading.CancellationToken,System.Threading.Tasks.ValueTask<Azure.Core.AccessToken>> getTokenAsync);
static member Create : Func<Azure.Core.TokenRequestContext, System.Threading.CancellationToken, Azure.Core.AccessToken> * Func<Azure.Core.TokenRequestContext, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask<Azure.Core.AccessToken>> -> Azure.Core.TokenCredential
Public Shared Function Create (getToken As Func(Of TokenRequestContext, CancellationToken, AccessToken), getTokenAsync As Func(Of TokenRequestContext, CancellationToken, ValueTask(Of AccessToken))) As TokenCredential

Parameters

getToken
Func<TokenRequestContext,CancellationToken,AccessToken>

A delegate that returns an AccessToken.

getTokenAsync
Func<TokenRequestContext,CancellationToken,ValueTask<AccessToken>>

A delegate that returns a ValueTask of type AccessToken.

Returns

Remarks

Typically, the TokenCredential created by this method is for use when you have already obtained an AccessToken from some other source and need a TokenCredential that will simply return that token. Because the static token can expire, the delegates offer a mechanism to handle AccessToken renewal.

Applies to