BearerTokenCredentialPolicy Class
Adds a bearer token Authorization header to requests.
- Inheritance
-
azure.core.pipeline.policies._authentication._BearerTokenCredentialPolicyBaseBearerTokenCredentialPolicyazure.core.pipeline.policies._base.HTTPPolicyBearerTokenCredentialPolicy
Constructor
BearerTokenCredentialPolicy(credential: TokenCredential, *scopes: str, **kwargs: Any)
Parameters
- credential
- <xref:azure.core.TokenCredential>
The credential.
Methods
| authorize_request |
Acquire a token from the credential and authorize the request with it. Keyword arguments are passed to the credential's get_token method. The token will be cached and used to authorize future requests. |
| on_challenge |
Authorize request according to an authentication challenge This method is called when the resource provider responds 401 with a WWW-Authenticate header. |
| on_exception |
Executed when an exception is raised while executing the next policy. This method is executed inside the exception handler. |
| on_request |
Called before the policy sends a request. The base implementation authorizes the request with a bearer token. |
| on_response |
Executed after the request comes back from the next policy. |
| send |
Authorize request with a bearer token and send it to the next policy |
authorize_request
Acquire a token from the credential and authorize the request with it.
Keyword arguments are passed to the credential's get_token method. The token will be cached and used to authorize future requests.
authorize_request(request: PipelineRequest, *scopes: str, **kwargs: Any) -> None
Parameters
on_challenge
Authorize request according to an authentication challenge
This method is called when the resource provider responds 401 with a WWW-Authenticate header.
on_challenge(request: PipelineRequest, response: PipelineResponse) -> bool
Parameters
Returns
a bool indicating whether the policy should send the request
on_exception
Executed when an exception is raised while executing the next policy.
This method is executed inside the exception handler.
on_exception(request: PipelineRequest) -> None
Parameters
on_request
Called before the policy sends a request.
The base implementation authorizes the request with a bearer token.
on_request(request: PipelineRequest) -> None
Parameters
on_response
Executed after the request comes back from the next policy.
on_response(request: PipelineRequest, response: PipelineResponse) -> None
Parameters
send
Authorize request with a bearer token and send it to the next policy
send(request: PipelineRequest) -> PipelineResponse
Parameters
Feedback
Submit and view feedback for