Class BearerTokenAuthenticationPolicy
- java.lang.Object
-
- com.azure.android.core.http.policy.BearerTokenAuthenticationPolicy
-
- All Implemented Interfaces:
HttpPipelinePolicy
public class BearerTokenAuthenticationPolicy extends java.lang.Object implements HttpPipelinePolicy
The pipeline policy that applies a token credential to an HTTP request with "Bearer" scheme.
-
-
Constructor Summary
Constructors Constructor Description BearerTokenAuthenticationPolicy(com.azure.android.core.credential.TokenCredential credential, java.lang.String... scopes)Creates BearerTokenAuthenticationPolicy.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidprocess(HttpPipelinePolicyChain chain)Applies the policy to aHttpRequestand the correspondingHttpResponse.
-
-
-
Constructor Detail
-
BearerTokenAuthenticationPolicy
public BearerTokenAuthenticationPolicy(com.azure.android.core.credential.TokenCredential credential, java.lang.String... scopes)Creates BearerTokenAuthenticationPolicy.- Parameters:
credential- the token credential to authenticate the requestscopes- the scopes of authentication the credential should get token for
-
-
Method Detail
-
process
public void process(HttpPipelinePolicyChain chain)
Description copied from interface:HttpPipelinePolicyApplies the policy to aHttpRequestand the correspondingHttpResponse.Policy implementations are expected to use
HttpPipelinePolicyChain.getRequest()to access and intercept the request, then proceed to next policy by callingHttpPipelinePolicyChain.processNextPolicy(HttpRequest)orHttpPipelinePolicyChain.processNextPolicy(HttpRequest, NextPolicyCallback). The policy can intercept the resulting response notified toNextPolicyCallback.onSuccess(HttpResponse, PolicyCompleter)or error notified toNextPolicyCallback.onError(Throwable, PolicyCompleter)and must signal the completion of the policy by callingPolicyCompleter.completed(HttpResponse)orPolicyCompleter.completedError(Throwable).- Specified by:
processin interfaceHttpPipelinePolicy- Parameters:
chain- The chain for the policy to access the request and response.
-
-