Class ArmChallengeAuthenticationPolicy
java.lang.Object
com.azure.core.http.policy.BearerTokenAuthenticationPolicy
com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy
- All Implemented Interfaces:
HttpPipelinePolicy
The pipeline policy that applies a token credential to an HTTP request with "Bearer" scheme in ARM challenge based
authentication scenarios.
-
Constructor Summary
ConstructorDescriptionArmChallengeAuthenticationPolicy
(TokenCredential credential, String... scopes) Creates ArmChallengeAuthenticationPolicy. -
Method Summary
Modifier and TypeMethodDescriptionauthorizeRequest
(HttpPipelineCallContext context) Executed before sending the initial request and authenticates the request.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 appropriateTokenRequestContext
to be used for re-authentication.boolean
authorizeRequestOnChallengeSync
(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 appropriateTokenRequestContext
to be used for re-authentication.void
Synchronously executed before sending the initial request and authenticates the request.String[]
getScopes
(HttpPipelineCallContext context, String[] scopes) Gets the scopes for the specific request.Methods inherited from class com.azure.core.http.policy.BearerTokenAuthenticationPolicy
process, processSync, setAuthorizationHeader, setAuthorizationHeaderSync
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.azure.core.http.policy.HttpPipelinePolicy
getPipelinePosition
-
Constructor Details
-
ArmChallengeAuthenticationPolicy
Creates ArmChallengeAuthenticationPolicy.- Parameters:
credential
- the token credential to authenticate the requestscopes
- the scopes used in credential, using default scopes when empty
-
-
Method Details
-
authorizeRequest
Description copied from class:com.azure.core.http.policy.BearerTokenAuthenticationPolicy
Executed before sending the initial request and authenticates the request.- Overrides:
authorizeRequest
in classBearerTokenAuthenticationPolicy
- Parameters:
context
- The request context.- Returns:
- A
Mono
containingVoid
-
authorizeRequestSync
Description copied from class:com.azure.core.http.policy.BearerTokenAuthenticationPolicy
Synchronously executed before sending the initial request and authenticates the request.- Overrides:
authorizeRequestSync
in classBearerTokenAuthenticationPolicy
- Parameters:
context
- The request context.
-
authorizeRequestOnChallenge
public Mono<Boolean> authorizeRequestOnChallenge(HttpPipelineCallContext context, HttpResponse response) Description copied from class:com.azure.core.http.policy.BearerTokenAuthenticationPolicy
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 appropriateTokenRequestContext
to be used for re-authentication.- Overrides:
authorizeRequestOnChallenge
in classBearerTokenAuthenticationPolicy
- Parameters:
context
- The request context.response
- The Http Response containing the authentication challenge header.- Returns:
- A
Mono
containingTokenRequestContext
-
authorizeRequestOnChallengeSync
public boolean authorizeRequestOnChallengeSync(HttpPipelineCallContext context, HttpResponse response) Description copied from class:com.azure.core.http.policy.BearerTokenAuthenticationPolicy
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 appropriateTokenRequestContext
to be used for re-authentication.- Overrides:
authorizeRequestOnChallengeSync
in classBearerTokenAuthenticationPolicy
- Parameters:
context
- The request context.response
- The Http Response containing the authentication challenge header.- Returns:
- A boolean indicating if containing the
TokenRequestContext
for re-authentication
-
getScopes
Gets the scopes for the specific request.- Parameters:
context
- The request.scopes
- Default scopes used by the policy.- Returns:
- The scopes for the specific request.
-