Condividi tramite


BearerTokenAuthenticationPolicy Class

Definition

A policy that sends an AccessToken provided by a TokenCredential as an Authentication header.

public class BearerTokenAuthenticationPolicy : Azure.Core.Pipeline.HttpPipelinePolicy
type BearerTokenAuthenticationPolicy = class
    inherit HttpPipelinePolicy
Public Class BearerTokenAuthenticationPolicy
Inherits HttpPipelinePolicy
Inheritance
BearerTokenAuthenticationPolicy

Constructors

BearerTokenAuthenticationPolicy(TokenCredential, IEnumerable<String>)

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

BearerTokenAuthenticationPolicy(TokenCredential, String)

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

Methods

AuthenticateAndAuthorizeRequest(HttpMessage, TokenRequestContext)

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

AuthenticateAndAuthorizeRequestAsync(HttpMessage, TokenRequestContext)

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

AuthorizeRequest(HttpMessage)

Executes before ProcessAsync(HttpMessage, ReadOnlyMemory<HttpPipelinePolicy>) or Process(HttpMessage, ReadOnlyMemory<HttpPipelinePolicy>) is called. Implementers of this method are expected to call AuthenticateAndAuthorizeRequest(HttpMessage, TokenRequestContext) or AuthenticateAndAuthorizeRequestAsync(HttpMessage, TokenRequestContext) if authorization is required for requests not related to handling a challenge response.

AuthorizeRequestAsync(HttpMessage)

Executes before ProcessAsync(HttpMessage, ReadOnlyMemory<HttpPipelinePolicy>) or Process(HttpMessage, ReadOnlyMemory<HttpPipelinePolicy>) is called. Implementers of this method are expected to call AuthenticateAndAuthorizeRequest(HttpMessage, TokenRequestContext) or AuthenticateAndAuthorizeRequestAsync(HttpMessage, TokenRequestContext) if authorization is required for requests not related to handling a challenge response.

AuthorizeRequestOnChallenge(HttpMessage)

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.

AuthorizeRequestOnChallengeAsync(HttpMessage)

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.

Process(HttpMessage, ReadOnlyMemory<HttpPipelinePolicy>)

Applies the policy to the message. Implementers are expected to mutate Request before calling ProcessNextAsync(HttpMessage, ReadOnlyMemory<HttpPipelinePolicy>) and observe the Response changes after.

ProcessAsync(HttpMessage, ReadOnlyMemory<HttpPipelinePolicy>)

Applies the policy to the message. Implementers are expected to mutate Request before calling ProcessNextAsync(HttpMessage, ReadOnlyMemory<HttpPipelinePolicy>) and observe the Response changes after.

Applies to