public abstract class AbstractOAuthDancer<T extends OAuthDancerConfig> extends Object implements org.mule.runtime.api.lifecycle.Startable, org.mule.runtime.api.lifecycle.Stoppable
| Modifier and Type | Field and Description |
|---|---|
protected T |
config |
static int |
TOKEN_REQUEST_TIMEOUT_MILLIS |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractOAuthDancer(T config) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
doAddListener(OAuthStateListener listener) |
protected <T> CompletableFuture<T> |
doRefreshToken(Supplier<ResourceOwnerOAuthContext> oauthContextSupplier,
Function<ResourceOwnerOAuthContext,CompletableFuture<T>> tokenRefreshRequester)
Method for refreshing tokens in a thread-safe manner across nodes of a cluster.
|
protected <T> CompletableFuture<T> |
doRefreshTokenRequest(Function<ResourceOwnerOAuthContext,CompletableFuture<T>> tokenRefreshRequester,
ResourceOwnerOAuthContext oauthContext) |
protected void |
doRemoveListener(OAuthStateListener listener) |
ResourceOwnerOAuthContext |
getContextForResourceOwner(String resourceOwnerId)
Retrieves the oauth context for a particular user.
|
protected List<? extends OAuthStateListener> |
getListenersToNotifyInvalidation(ResourceOwnerOAuthContext resourceOwnerOAuthContext)
Retrieves all the listeners that should be notified of a token invalidation event.
|
protected org.mule.runtime.api.lock.LockFactory |
getLockProvider() |
protected String |
handleClientCredentials(Map<String,String> formData)
Based on the value of
clientCredentialsLocation, 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,
org.mule.runtime.api.util.MultiMap<String,String> queryParams,
org.mule.runtime.api.util.MultiMap<String,String> headers,
String authorization,
boolean retrieveRefreshToken,
Charset encoding) |
protected void |
onEachListener(Consumer<OAuthStateListener> action) |
protected void |
onEachListener(List<? extends OAuthStateListener> listeners,
Consumer<OAuthStateListener> action) |
protected TokenResponse |
parseTokenResponse(org.mule.runtime.http.api.domain.message.response.HttpResponse response,
String tokenUrl,
boolean retrieveRefreshToken) |
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() |
protected void |
startHttpClient() |
void |
stop() |
protected void |
stopHttpClient() |
protected <T> Function<Throwable,? extends T> |
tokenUrlExceptionHandler(ResourceOwnerOAuthContext defaultUserState) |
protected void |
updateOAuthContextAfterTokenResponse(ResourceOwnerOAuthContext defaultUserState) |
protected void |
updateResourceOwnerOAuthContext(ResourceOwnerOAuthContext resourceOwnerOAuthContext)
Updates the resource owner oauth context information
|
public static final int TOKEN_REQUEST_TIMEOUT_MILLIS
protected final T extends OAuthDancerConfig config
protected AbstractOAuthDancer(T config)
public void start()
throws org.mule.runtime.api.exception.MuleException
start in interface org.mule.runtime.api.lifecycle.Startableorg.mule.runtime.api.exception.MuleExceptionprotected void startHttpClient()
public void stop()
throws org.mule.runtime.api.exception.MuleException
stop in interface org.mule.runtime.api.lifecycle.Stoppableorg.mule.runtime.api.exception.MuleExceptionprotected void stopHttpClient()
protected String handleClientCredentials(Map<String,String> formData)
clientCredentialsLocation, add the clientId and clientSecret values to the form or encode and
return them.formData - protected <T> CompletableFuture<T> doRefreshToken(Supplier<ResourceOwnerOAuthContext> oauthContextSupplier, Function<ResourceOwnerOAuthContext,CompletableFuture<T>> tokenRefreshRequester)
protected <T> CompletableFuture<T> doRefreshTokenRequest(Function<ResourceOwnerOAuthContext,CompletableFuture<T>> tokenRefreshRequester, ResourceOwnerOAuthContext oauthContext)
protected CompletableFuture<TokenResponse> invokeTokenUrl(String tokenUrl, Map<String,String> tokenRequestFormToSend, org.mule.runtime.api.util.MultiMap<String,String> queryParams, org.mule.runtime.api.util.MultiMap<String,String> headers, String authorization, boolean retrieveRefreshToken, Charset encoding)
protected TokenResponse parseTokenResponse(org.mule.runtime.http.api.domain.message.response.HttpResponse response, String tokenUrl, boolean retrieveRefreshToken)
protected void updateOAuthContextAfterTokenResponse(ResourceOwnerOAuthContext defaultUserState)
protected <T> Function<Throwable,? extends T> tokenUrlExceptionHandler(ResourceOwnerOAuthContext defaultUserState)
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)
protected List<? extends OAuthStateListener> getListenersToNotifyInvalidation(ResourceOwnerOAuthContext resourceOwnerOAuthContext)
resourceOwnerOAuthContext - contextpublic ResourceOwnerOAuthContext getContextForResourceOwner(String resourceOwnerId)
resourceOwnerId - id of the user.protected void updateResourceOwnerOAuthContext(ResourceOwnerOAuthContext resourceOwnerOAuthContext)
resourceOwnerOAuthContext - protected org.mule.runtime.api.lock.LockFactory getLockProvider()
protected void doAddListener(OAuthStateListener listener)
protected void doRemoveListener(OAuthStateListener listener)
protected void onEachListener(Consumer<OAuthStateListener> action)
protected void onEachListener(List<? extends OAuthStateListener> listeners, Consumer<OAuthStateListener> action)
Copyright © 2022. All rights reserved.