Method ApplyAuthorizationAsync
ApplyAuthorizationAsync(Request, HttpRequestMessage, CancellationToken)
Obtains and supplies the authorization information to the request.
Declaration
Task ApplyAuthorizationAsync(Request request, HttpRequestMessage message, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Request | request | The Request object representing the running operation. |
HttpRequestMessage | message | HTTP request message for the request. |
CancellationToken | cancellationToken | Cancellation token. |
Returns
Type | Description |
---|---|
Task | Task that completes when the required
authorization information is obtained and added to the
request message . |
Remarks
message
parameter is the HTTP request message
and contains both the headers and the content of the request
message. Modify this message to supply the required
authorization information. Normally this involves adding
authorization headers, for which you can use
Headers property of
HttpRequestMessage to access the
HttpRequestHeaders collection of the request
message.
Obtaining the required authorization information may be an asynchronous operation, thus this method is asynchronous.
Exceptions
Type | Condition |
---|---|
AuthorizationException | If failed to obtain the required authorization information. Use this exception to wrap any provider-specific exception. |