public class BearerTokenAuthenticationPolicy extends Object implements HttpPipelinePolicy
Constructor and Description |
---|
BearerTokenAuthenticationPolicy(TokenCredential credential,
String... scopes)
Creates BearerTokenAuthenticationPolicy.
|
Modifier and Type | Method and Description |
---|---|
Mono<Void> |
authorizeRequest(HttpPipelineCallContext context)
Executed before sending the initial request and authenticates the request.
|
Mono<Boolean> |
authorizeRequestOnChallenge(HttpPipelineCallContext context,
HttpResponse response)
Handles the authentication challenge in the event a 401 response with a WWW-Authenticate authentication
challenge header is received after the initial request and returns appropriate
TokenRequestContext to
be used for re-authentication. |
Mono<HttpResponse> |
process(HttpPipelineCallContext context,
HttpPipelineNextPolicy next)
Processes provided request context and invokes the next policy.
|
Mono<Void> |
setAuthorizationHeader(HttpPipelineCallContext context,
TokenRequestContext tokenRequestContext)
Authorizes the request with the bearer token acquired using the specified
tokenRequestContext |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPipelinePosition
public BearerTokenAuthenticationPolicy(TokenCredential credential, String... scopes)
credential
- the token credential to authenticate the requestscopes
- the scopes of authentication the credential should get token forpublic Mono<Void> authorizeRequest(HttpPipelineCallContext context)
public Mono<Boolean> authorizeRequestOnChallenge(HttpPipelineCallContext context, HttpResponse response)
TokenRequestContext
to
be used for re-authentication.context
- The request context.response
- The Http Response containing the authentication challenge header.Mono
containing TokenRequestContext
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next)
HttpPipelinePolicy
process
in interface HttpPipelinePolicy
context
- The request context.next
- The next policy to invoke.public Mono<Void> setAuthorizationHeader(HttpPipelineCallContext context, TokenRequestContext tokenRequestContext)
tokenRequestContext
Copyright © 2021 Microsoft Corporation. All rights reserved.