public class DefaultAuthorizationCodeOAuthDancer extends AbstractOAuthDancer<DefaultAuthorizationCodeOAuthDancerConfig> implements AuthorizationCodeOAuthDancer, org.mule.runtime.api.lifecycle.Lifecycle
config, TOKEN_REQUEST_TIMEOUT_MILLIS| Constructor and Description |
|---|
DefaultAuthorizationCodeOAuthDancer(DefaultAuthorizationCodeOAuthDancerConfig config) |
| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<String> |
accessToken(String resourceOwner)
Will query the internal state (the
tokensStore parameter passed to the service to build the
AuthorizationCodeOAuthDancer) to get the appropriate accessToken. |
void |
addListener(AuthorizationCodeListener listener)
Adds the
listener. |
void |
addListener(String resourceOwnerId,
AuthorizationCodeListener listener)
Adds the
listener. |
void |
dispose() |
protected CompletableFuture<Void> |
doRefreshTokenRequest(boolean useQueryParameters,
ResourceOwnerOAuthContextWithRefreshState resourceOwnerOAuthContext) |
protected List<? extends OAuthStateListener> |
getListenersToNotifyInvalidation(ResourceOwnerOAuthContext resourceOwnerOAuthContext)
Retrieves all the listeners that should be notified of a token invalidation event, i.e.
|
void |
handleLocalAuthorizationRequest(org.mule.runtime.http.api.domain.message.request.HttpRequest request,
org.mule.runtime.http.api.server.async.HttpResponseReadyCallback responseCallback)
Handles an http request that will redirect to the access page in
authorizationUrl with the configured credentials. |
void |
initialise() |
CompletableFuture<Void> |
refreshToken(String resourceOwner)
Performs the refresh of the access token.
|
CompletableFuture<Void> |
refreshToken(String resourceOwner,
boolean useQueryParameters)
Performs the refresh of the access token.
|
void |
removeListener(AuthorizationCodeListener listener)
Removes the
listener. |
void |
removeListener(String resourceOwnerId,
AuthorizationCodeListener listener)
Removes the
listener. |
void |
start() |
void |
stop() |
doAddListener, doRefreshToken, doRefreshTokenRequest, doRemoveListener, getContextForResourceOwner, getLockProvider, handleClientCredentials, invalidateContext, invokeTokenUrl, onEachListener, onEachListener, parseTokenResponse, resolveExpression, resolveExpression, startHttpClient, stopHttpClient, tokenUrlExceptionHandler, updateOAuthContextAfterTokenResponse, updateResourceOwnerOAuthContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetContextForResourceOwner, invalidateContextpublic DefaultAuthorizationCodeOAuthDancer(DefaultAuthorizationCodeOAuthDancerConfig config)
public void initialise()
throws org.mule.runtime.api.lifecycle.InitialisationException
initialise in interface org.mule.runtime.api.lifecycle.Initialisableorg.mule.runtime.api.lifecycle.InitialisationExceptionpublic void addListener(AuthorizationCodeListener listener)
AuthorizationCodeOAuthDancerlistener. Listeners will be invoked in the same order as they were addedaddListener in interface AuthorizationCodeOAuthDancerlistener - the AuthorizationCodeListener to be addedpublic void removeListener(AuthorizationCodeListener listener)
AuthorizationCodeOAuthDancerlistener. Nothing happens if it wasn't part of this dancer.removeListener in interface AuthorizationCodeOAuthDancerlistener - the AuthorizationCodeListener to be removedpublic void addListener(String resourceOwnerId, AuthorizationCodeListener listener)
AuthorizationCodeOAuthDancerlistener. Listeners will be invoked in the same order as they were addedaddListener in interface AuthorizationCodeOAuthDancerresourceOwnerId - id of the user who the listener corresponds tolistener - the AuthorizationCodeListener to be addedpublic void removeListener(String resourceOwnerId, AuthorizationCodeListener listener)
AuthorizationCodeOAuthDancerlistener. Nothing happens if it wasn't part of this dancer.removeListener in interface AuthorizationCodeOAuthDancerresourceOwnerId - id of the user who the listener corresponds tolistener - the AuthorizationCodeListener to be removedpublic void handleLocalAuthorizationRequest(org.mule.runtime.http.api.domain.message.request.HttpRequest request,
org.mule.runtime.http.api.server.async.HttpResponseReadyCallback responseCallback)
AuthorizationCodeOAuthDancerauthorizationUrl with the configured credentials.handleLocalAuthorizationRequest in interface AuthorizationCodeOAuthDancerrequest - the request from the user to login and/or authorize the applicationresponseCallback - the callback where the response with the redirection to the login/authorization page will be sentpublic void start()
throws org.mule.runtime.api.exception.MuleException
start in interface org.mule.runtime.api.lifecycle.Startablestart in class AbstractOAuthDancer<DefaultAuthorizationCodeOAuthDancerConfig>org.mule.runtime.api.exception.MuleExceptionpublic void stop()
throws org.mule.runtime.api.exception.MuleException
stop in interface org.mule.runtime.api.lifecycle.Stoppablestop in class AbstractOAuthDancer<DefaultAuthorizationCodeOAuthDancerConfig>org.mule.runtime.api.exception.MuleExceptionpublic void dispose()
dispose in interface org.mule.runtime.api.lifecycle.Disposablepublic CompletableFuture<String> accessToken(String resourceOwner) throws RequestAuthenticationException
AuthorizationCodeOAuthDancertokensStore parameter passed to the service to build the
AuthorizationCodeOAuthDancer) to get the appropriate accessToken. This requires that the authorization has been
performed beforehand, otherwise, a RequestAuthenticationException will be thrown.accessToken in interface AuthorizationCodeOAuthDancerresourceOwner - The resource owner to get the token for.RequestAuthenticationException - if called for a resourceOwner that has not yet been authorized.public CompletableFuture<Void> refreshToken(String resourceOwner)
AuthorizationCodeOAuthDancerrefreshToken in interface AuthorizationCodeOAuthDancerresourceOwner - The resource owner to get the token for.public CompletableFuture<Void> refreshToken(String resourceOwner, boolean useQueryParameters)
AuthorizationCodeOAuthDancerrefreshToken in interface AuthorizationCodeOAuthDancerresourceOwner - The resource owner to get the token for.useQueryParameters - If the parameters needed to refresh the token should be sent as query parameters. If false, they
will be sent encoded in the body of the message.protected CompletableFuture<Void> doRefreshTokenRequest(boolean useQueryParameters, ResourceOwnerOAuthContextWithRefreshState resourceOwnerOAuthContext)
protected List<? extends OAuthStateListener> getListenersToNotifyInvalidation(ResourceOwnerOAuthContext resourceOwnerOAuthContext)
getListenersToNotifyInvalidation in class AbstractOAuthDancer<DefaultAuthorizationCodeOAuthDancerConfig>resourceOwnerOAuthContext - contextCopyright © 2022. All rights reserved.