<PackageReference Include="Azure.Core" Version="1.44.1" />

BearerTokenAuthenticationPolicy

A policy that sends an AccessToken provided by a TokenCredential as an Authentication header.
public BearerTokenAuthenticationPolicy(TokenCredential credential, string scope)

Creates a new instance of BearerTokenAuthenticationPolicy using provided token credential and scope to authenticate for.

public BearerTokenAuthenticationPolicy(TokenCredential credential, IEnumerable<string> scopes)

Creates a new instance of BearerTokenAuthenticationPolicy using provided token credential and scopes to authenticate for.

Sets the Authorization header on the Request by calling GetToken, or from cache, if possible.

Sets the Authorization header on the Request by calling GetToken, or from cache, if possible.

protected virtual void AuthorizeRequest(HttpMessage message)

Executes before ProcessAsync or Process is called. Implementers of this method are expected to call AuthenticateAndAuthorizeRequest or AuthenticateAndAuthorizeRequestAsync if authorization is required for requests not related to handling a challenge response.

protected virtual ValueTask AuthorizeRequestAsync(HttpMessage message)

Executes before ProcessAsync or Process is called. Implementers of this method are expected to call AuthenticateAndAuthorizeRequest or AuthenticateAndAuthorizeRequestAsync if authorization is required for requests not related to handling a challenge response.

protected virtual bool AuthorizeRequestOnChallenge(HttpMessage message)

Executed in the event a 401 response with a WWW-Authenticate authentication challenge header is received after the initial request. The default implementation will attempt to handle Continuous Access Evaluation (CAE) claims challenges.

protected virtual ValueTask<bool> AuthorizeRequestOnChallengeAsync(HttpMessage message)

Executed in the event a 401 response with a WWW-Authenticate authentication challenge header is received after the initial request. The default implementation will attempt to handle Continuous Access Evaluation (CAE) claims challenges.