public class OAuthRestConnection extends DefaultRestConnection
DefaultRestConnection for resources protected with OAuth, regardless of the grant type.
The main features of this connection are that:
CompletableFuture will be completed with
an AccessTokenExpiredException so that the SDK triggers the refresh token workflow.| Constructor and Description |
|---|
OAuthRestConnection(String baseUri,
String configName,
org.mule.runtime.http.api.client.HttpClient httpClient,
org.mule.runtime.http.api.client.auth.HttpAuthentication authentication,
org.mule.runtime.api.util.MultiMap<String,String> defaultQueryParams,
org.mule.runtime.api.util.MultiMap<String,String> defaultHeaders,
org.mule.runtime.extension.api.connectivity.oauth.OAuthState oauthState,
String resourceOwnerId,
org.mule.runtime.api.el.ExpressionLanguage expressionLanguage,
String refreshTokenCondition)
Creates a new instance
|
| Modifier and Type | Method and Description |
|---|---|
protected org.mule.runtime.http.api.domain.message.request.HttpRequest |
buildRequest(RestRequestBuilder requestBuilder) |
Optional<String> |
getRefreshTokenCondition() |
protected void |
handleResponseError(org.mule.runtime.http.api.domain.message.response.HttpResponse response,
org.mule.runtime.api.metadata.MediaType defaultResponseMediaType,
CompletableFuture<org.mule.runtime.extension.api.runtime.operation.Result<InputStream,HttpResponseAttributes>> future,
org.mule.runtime.extension.api.runtime.streaming.StreamingHelper streamingHelper,
RestError error) |
afterStop, beforeStop, bodylessRequest, getBaseUri, getExpressionLanguage, request, stop, toAttributes, toResult, validatepublic OAuthRestConnection(String baseUri, String configName, org.mule.runtime.http.api.client.HttpClient httpClient, org.mule.runtime.http.api.client.auth.HttpAuthentication authentication, org.mule.runtime.api.util.MultiMap<String,String> defaultQueryParams, org.mule.runtime.api.util.MultiMap<String,String> defaultHeaders, org.mule.runtime.extension.api.connectivity.oauth.OAuthState oauthState, String resourceOwnerId, org.mule.runtime.api.el.ExpressionLanguage expressionLanguage, String refreshTokenCondition)
baseUri - the service base uriconfigName - the name of the config that owns this connectionhttpClient - the client to useauthentication - the authentication mechanism to use, or nulldefaultQueryParams - query params to be automatically added to all requests done through this connectiondefaultHeaders - headers to be automatically added to all requests done through this connectionoauthState - the OAuthState for the current connectionresourceOwnerId - the id of the resource owner for this connectionexpressionLanguage - An expression language instance.refreshTokenCondition - An expression that causes the token to be renewed when return true.protected org.mule.runtime.http.api.domain.message.request.HttpRequest buildRequest(RestRequestBuilder requestBuilder)
buildRequest in class DefaultRestConnectionprotected void handleResponseError(org.mule.runtime.http.api.domain.message.response.HttpResponse response,
org.mule.runtime.api.metadata.MediaType defaultResponseMediaType,
CompletableFuture<org.mule.runtime.extension.api.runtime.operation.Result<InputStream,HttpResponseAttributes>> future,
org.mule.runtime.extension.api.runtime.streaming.StreamingHelper streamingHelper,
RestError error)
handleResponseError in class DefaultRestConnectionCopyright © 2021. All rights reserved.