Class AbstractOAuthDancer<T extends OAuthDancerConfig>

    • Constructor Detail

      • AbstractOAuthDancer

        protected AbstractOAuthDancer​(T config)
    • Method Detail

      • start

        public void start()
                   throws org.mule.runtime.api.exception.MuleException
        Specified by:
        start in interface org.mule.runtime.api.lifecycle.Startable
        Throws:
        org.mule.runtime.api.exception.MuleException
      • startHttpClient

        protected void startHttpClient()
      • stop

        public void stop()
                  throws org.mule.runtime.api.exception.MuleException
        Specified by:
        stop in interface org.mule.runtime.api.lifecycle.Stoppable
        Throws:
        org.mule.runtime.api.exception.MuleException
      • stopHttpClient

        protected void stopHttpClient()
      • handleClientCredentials

        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.
        Parameters:
        formData -
      • doRefreshToken

        protected <T> CompletableFuture<T> doRefreshToken​(Supplier<org.mule.oauth.client.api.state.ResourceOwnerOAuthContext> oauthContextSupplier,
                                                          Function<org.mule.oauth.client.api.state.ResourceOwnerOAuthContext,​CompletableFuture<T>> tokenRefreshRequester)
        Method for refreshing tokens in a thread-safe manner across nodes of a cluster.
      • doRefreshTokenRequest

        protected <T> CompletableFuture<T> doRefreshTokenRequest​(Function<org.mule.oauth.client.api.state.ResourceOwnerOAuthContext,​CompletableFuture<T>> tokenRefreshRequester,
                                                                 org.mule.oauth.client.api.state.ResourceOwnerOAuthContext oauthContext)
      • parseTokenResponse

        protected TokenResponse parseTokenResponse​(org.mule.runtime.http.api.domain.message.response.HttpResponse response,
                                                   String tokenUrl,
                                                   boolean retrieveRefreshToken)
      • updateOAuthContextAfterTokenResponse

        protected void updateOAuthContextAfterTokenResponse​(org.mule.oauth.client.api.state.ResourceOwnerOAuthContext defaultUserState)
      • tokenUrlExceptionHandler

        protected <T> Function<Throwable,​? extends T> tokenUrlExceptionHandler​(org.mule.oauth.client.api.state.ResourceOwnerOAuthContext defaultUserState)
      • resolveExpression

        protected <T> T resolveExpression​(String expr,
                                          Object body,
                                          org.mule.runtime.api.util.MultiMap<String,​String> headers,
                                          org.mule.runtime.api.metadata.MediaType responseContentType)
      • resolveExpression

        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)
      • invalidateContext

        public void invalidateContext​(String resourceOwner)
      • 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. Depending on the implementation these listeners could be 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).
        Parameters:
        resourceOwnerOAuthContext - context
        Returns:
        the listeners to be notified of the token invalidation event.
      • getContextForResourceOwner

        public org.mule.oauth.client.api.state.ResourceOwnerOAuthContext getContextForResourceOwner​(String resourceOwnerId)
        Retrieves the oauth context for a particular user. If there's no state for that user a new state is retrieve so never returns null.
        Parameters:
        resourceOwnerId - id of the user.
        Returns:
        oauth state
      • updateResourceOwnerOAuthContext

        protected void updateResourceOwnerOAuthContext​(org.mule.oauth.client.api.state.ResourceOwnerOAuthContext resourceOwnerOAuthContext)
        Updates the resource owner oauth context information
        Parameters:
        resourceOwnerOAuthContext -
      • getLockProvider

        protected org.mule.runtime.api.lock.LockFactory getLockProvider()
      • doAddListener

        protected void doAddListener​(org.mule.oauth.client.api.listener.OAuthStateListener listener)
      • doRemoveListener

        protected void doRemoveListener​(org.mule.oauth.client.api.listener.OAuthStateListener listener)
      • onEachListener

        protected void onEachListener​(Consumer<org.mule.oauth.client.api.listener.OAuthStateListener> action)
      • onEachListener

        protected void onEachListener​(List<? extends org.mule.oauth.client.api.listener.OAuthStateListener> listeners,
                                      Consumer<org.mule.oauth.client.api.listener.OAuthStateListener> action)