public abstract class AbstractOAuthDancer extends Object implements org.mule.runtime.api.lifecycle.Startable, org.mule.runtime.api.lifecycle.Stoppable
| Modifier and Type | Field and Description |
|---|---|
protected String |
clientId |
protected String |
clientSecret |
protected Map<String,String> |
customParametersExtractorsExprs |
protected boolean |
encodeClientCredentialsInBody |
protected Charset |
encoding |
protected Function<String,String> |
resourceOwnerIdTransformer |
protected String |
responseAccessTokenExpr |
protected String |
responseExpiresInExpr |
protected String |
responseRefreshTokenExpr |
protected String |
scopes |
protected String |
tokenUrl |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractOAuthDancer(String clientId,
String clientSecret,
String tokenUrl,
Charset encoding,
String scopes,
boolean encodeClientCredentialsInBody,
String responseAccessTokenExpr,
String responseRefreshTokenExpr,
String responseExpiresInExpr,
Map<String,String> customParametersExtractorsExprs,
Function<String,String> resourceOwnerIdTransformer,
org.mule.runtime.api.lock.LockFactory lockProvider,
Map<String,org.mule.runtime.oauth.api.state.DefaultResourceOwnerOAuthContext> tokensStore,
org.mule.runtime.http.api.client.HttpClient httpClient,
org.mule.runtime.api.el.MuleExpressionLanguage expressionEvaluator) |
| Modifier and Type | Method and Description |
|---|---|
org.mule.runtime.oauth.api.state.ResourceOwnerOAuthContext |
getContextForResourceOwner(String resourceOwnerId)
Retrieves the oauth context for a particular user.
|
protected String |
handleClientCredentials(Map<String,String> formData,
boolean encodeClientCredentialsInBody)
Based on the value of
encodeClientCredentialsInBody, add the clientId and clientSecret values to the form or encode
and return them. |
void |
invalidateContext(String resourceOwner) |
protected CompletableFuture<TokenResponse> |
invokeTokenUrl(String tokenUrl,
Map<String,String> tokenRequestFormToSend,
String authorization,
boolean retrieveRefreshToken,
Charset encoding) |
protected <T> T |
resolveExpression(String expr,
Object body,
org.mule.runtime.api.util.MultiMap<String,String> headers,
org.mule.runtime.api.metadata.MediaType responseContentType) |
protected <T> T |
resolveExpression(String expr,
Object body,
org.mule.runtime.api.util.MultiMap<String,String> headers,
org.mule.runtime.api.util.MultiMap<String,String> queryParams,
org.mule.runtime.api.metadata.MediaType responseContentType) |
void |
start() |
void |
stop() |
protected void |
updateResourceOwnerOAuthContext(org.mule.runtime.oauth.api.state.DefaultResourceOwnerOAuthContext resourceOwnerOAuthContext)
Updates the resource owner oauth context information
|
protected final String clientId
protected final String clientSecret
protected final String tokenUrl
protected final Charset encoding
protected final String scopes
protected final boolean encodeClientCredentialsInBody
protected final String responseAccessTokenExpr
protected final String responseRefreshTokenExpr
protected final String responseExpiresInExpr
protected AbstractOAuthDancer(String clientId, String clientSecret, String tokenUrl, Charset encoding, String scopes, boolean encodeClientCredentialsInBody, String responseAccessTokenExpr, String responseRefreshTokenExpr, String responseExpiresInExpr, Map<String,String> customParametersExtractorsExprs, Function<String,String> resourceOwnerIdTransformer, org.mule.runtime.api.lock.LockFactory lockProvider, Map<String,org.mule.runtime.oauth.api.state.DefaultResourceOwnerOAuthContext> tokensStore, org.mule.runtime.http.api.client.HttpClient httpClient, org.mule.runtime.api.el.MuleExpressionLanguage expressionEvaluator)
public void start()
throws org.mule.runtime.api.exception.MuleException
start in interface org.mule.runtime.api.lifecycle.Startableorg.mule.runtime.api.exception.MuleExceptionpublic void stop()
throws org.mule.runtime.api.exception.MuleException
stop in interface org.mule.runtime.api.lifecycle.Stoppableorg.mule.runtime.api.exception.MuleExceptionprotected String handleClientCredentials(Map<String,String> formData, boolean encodeClientCredentialsInBody)
encodeClientCredentialsInBody, add the clientId and clientSecret values to the form or encode
and return them.formData - encodeClientCredentialsInBody - protected CompletableFuture<TokenResponse> invokeTokenUrl(String tokenUrl, Map<String,String> tokenRequestFormToSend, String authorization, boolean retrieveRefreshToken, Charset encoding)
protected <T> T resolveExpression(String expr, Object body, org.mule.runtime.api.util.MultiMap<String,String> headers, org.mule.runtime.api.metadata.MediaType responseContentType)
protected <T> T resolveExpression(String expr, Object body, org.mule.runtime.api.util.MultiMap<String,String> headers, org.mule.runtime.api.util.MultiMap<String,String> queryParams, org.mule.runtime.api.metadata.MediaType responseContentType)
public void invalidateContext(String resourceOwner)
public org.mule.runtime.oauth.api.state.ResourceOwnerOAuthContext getContextForResourceOwner(String resourceOwnerId)
resourceOwnerId - id of the user.protected void updateResourceOwnerOAuthContext(org.mule.runtime.oauth.api.state.DefaultResourceOwnerOAuthContext resourceOwnerOAuthContext)
resourceOwnerOAuthContext - Copyright © 2003–2018 MuleSoft, Inc.. All rights reserved.