Module org.mule.oauth.client.impl
Package org.mule.oauth.client.internal
Class DefaultAuthorizationCodeOAuthDancer
- java.lang.Object
-
- org.mule.oauth.client.internal.AbstractOAuthDancer<DefaultAuthorizationCodeOAuthDancerConfig>
-
- org.mule.oauth.client.internal.DefaultAuthorizationCodeOAuthDancer
-
- All Implemented Interfaces:
org.mule.oauth.client.api.AuthorizationCodeOAuthDancer,org.mule.runtime.api.lifecycle.Disposable,org.mule.runtime.api.lifecycle.Initialisable,org.mule.runtime.api.lifecycle.Lifecycle,org.mule.runtime.api.lifecycle.Startable,org.mule.runtime.api.lifecycle.Stoppable
public class DefaultAuthorizationCodeOAuthDancer extends AbstractOAuthDancer<DefaultAuthorizationCodeOAuthDancerConfig> implements org.mule.oauth.client.api.AuthorizationCodeOAuthDancer, org.mule.runtime.api.lifecycle.Lifecycle
Provides OAuth dance support for authorization-code grant-type.- Since:
- 1.0
-
-
Field Summary
-
Fields inherited from class org.mule.oauth.client.internal.AbstractOAuthDancer
config, TOKEN_REQUEST_TIMEOUT_MILLIS
-
-
Constructor Summary
Constructors Constructor Description DefaultAuthorizationCodeOAuthDancer(DefaultAuthorizationCodeOAuthDancerConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletableFuture<String>accessToken(String resourceOwner)voidaddListener(String resourceOwnerId, org.mule.oauth.client.api.listener.AuthorizationCodeListener listener)voidaddListener(org.mule.oauth.client.api.listener.AuthorizationCodeListener listener)voiddispose()protected CompletableFuture<Void>doRefreshTokenRequest(boolean useQueryParameters, org.mule.oauth.client.api.state.ResourceOwnerOAuthContextWithRefreshState resourceOwnerOAuthContext)protected List<? extends org.mule.oauth.client.api.listener.OAuthStateListener>getListenersToNotifyInvalidation(org.mule.oauth.client.api.state.ResourceOwnerOAuthContext resourceOwnerOAuthContext)Retrieves all the listeners that should be notified of a token invalidation event, i.e.voidhandleLocalAuthorizationRequest(org.mule.runtime.http.api.domain.message.request.HttpRequest request, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback responseCallback)voidinitialise()CompletableFuture<Void>refreshToken(String resourceOwner)CompletableFuture<Void>refreshToken(String resourceOwner, boolean useQueryParameters)voidremoveListener(String resourceOwnerId, org.mule.oauth.client.api.listener.AuthorizationCodeListener listener)voidremoveListener(org.mule.oauth.client.api.listener.AuthorizationCodeListener listener)voidstart()voidstop()-
Methods inherited from class org.mule.oauth.client.internal.AbstractOAuthDancer
doAddListener, doRefreshToken, doRefreshTokenRequest, doRemoveListener, getContextForResourceOwner, getLockProvider, handleClientCredentials, invalidateContext, invokeTokenUrl, onEachListener, onEachListener, parseTokenResponse, resolveExpression, resolveExpression, startHttpClient, stopHttpClient, tokenUrlExceptionHandler, updateOAuthContextAfterTokenResponse, updateResourceOwnerOAuthContext
-
-
-
-
Constructor Detail
-
DefaultAuthorizationCodeOAuthDancer
public DefaultAuthorizationCodeOAuthDancer(DefaultAuthorizationCodeOAuthDancerConfig config)
-
-
Method Detail
-
initialise
public void initialise() throws org.mule.runtime.api.lifecycle.InitialisationException- Specified by:
initialisein interfaceorg.mule.runtime.api.lifecycle.Initialisable- Throws:
org.mule.runtime.api.lifecycle.InitialisationException
-
addListener
public void addListener(org.mule.oauth.client.api.listener.AuthorizationCodeListener listener)
- Specified by:
addListenerin interfaceorg.mule.oauth.client.api.AuthorizationCodeOAuthDancer
-
removeListener
public void removeListener(org.mule.oauth.client.api.listener.AuthorizationCodeListener listener)
- Specified by:
removeListenerin interfaceorg.mule.oauth.client.api.AuthorizationCodeOAuthDancer
-
addListener
public void addListener(String resourceOwnerId, org.mule.oauth.client.api.listener.AuthorizationCodeListener listener)
- Specified by:
addListenerin interfaceorg.mule.oauth.client.api.AuthorizationCodeOAuthDancer
-
removeListener
public void removeListener(String resourceOwnerId, org.mule.oauth.client.api.listener.AuthorizationCodeListener listener)
- Specified by:
removeListenerin interfaceorg.mule.oauth.client.api.AuthorizationCodeOAuthDancer
-
handleLocalAuthorizationRequest
public void handleLocalAuthorizationRequest(org.mule.runtime.http.api.domain.message.request.HttpRequest request, org.mule.runtime.http.api.server.async.HttpResponseReadyCallback responseCallback)- Specified by:
handleLocalAuthorizationRequestin interfaceorg.mule.oauth.client.api.AuthorizationCodeOAuthDancer
-
start
public void start() throws org.mule.runtime.api.exception.MuleException- Specified by:
startin interfaceorg.mule.runtime.api.lifecycle.Startable- Overrides:
startin classAbstractOAuthDancer<DefaultAuthorizationCodeOAuthDancerConfig>- Throws:
org.mule.runtime.api.exception.MuleException
-
stop
public void stop() throws org.mule.runtime.api.exception.MuleException- Specified by:
stopin interfaceorg.mule.runtime.api.lifecycle.Stoppable- Overrides:
stopin classAbstractOAuthDancer<DefaultAuthorizationCodeOAuthDancerConfig>- Throws:
org.mule.runtime.api.exception.MuleException
-
dispose
public void dispose()
- Specified by:
disposein interfaceorg.mule.runtime.api.lifecycle.Disposable
-
accessToken
public CompletableFuture<String> accessToken(String resourceOwner) throws org.mule.oauth.client.api.exception.RequestAuthenticationException
- Specified by:
accessTokenin interfaceorg.mule.oauth.client.api.AuthorizationCodeOAuthDancer- Throws:
org.mule.oauth.client.api.exception.RequestAuthenticationException
-
refreshToken
public CompletableFuture<Void> refreshToken(String resourceOwner)
- Specified by:
refreshTokenin interfaceorg.mule.oauth.client.api.AuthorizationCodeOAuthDancer
-
refreshToken
public CompletableFuture<Void> refreshToken(String resourceOwner, boolean useQueryParameters)
- Specified by:
refreshTokenin interfaceorg.mule.oauth.client.api.AuthorizationCodeOAuthDancer
-
doRefreshTokenRequest
protected CompletableFuture<Void> doRefreshTokenRequest(boolean useQueryParameters, org.mule.oauth.client.api.state.ResourceOwnerOAuthContextWithRefreshState resourceOwnerOAuthContext)
-
getListenersToNotifyInvalidation
protected List<? extends org.mule.oauth.client.api.listener.OAuthStateListener> getListenersToNotifyInvalidation(org.mule.oauth.client.api.state.ResourceOwnerOAuthContext resourceOwnerOAuthContext)
Retrieves all the listeners that should be notified of a token invalidation event, i.e. the ones registered associated to the given resource owner in an explicit way and the ones that were registered in a general way (without indicating the resource owner) in order not to break backward compatibility.- Overrides:
getListenersToNotifyInvalidationin classAbstractOAuthDancer<DefaultAuthorizationCodeOAuthDancerConfig>- Parameters:
resourceOwnerOAuthContext- context- Returns:
- the listeners to be notified of the token invalidation event.
-
-