Interface OAuthDancerBuilder<D>

    • Method Detail

      • name

        default OAuthDancerBuilder<D> name​(String name)
        Parameters:
        name - the name for this dancer to use for ids generation
        Returns:
        this builder
      • clientCredentials

        OAuthDancerBuilder<D> clientCredentials​(String clientId,
                                                String clientSecret)
        Parameters:
        clientId - the application identifier as defined in the OAuth authentication server.
        clientSecret - the application secret as defined in the OAuth authentication server.
        Returns:
        this builder
      • withClientCredentialsIn

        default OAuthDancerBuilder<D> withClientCredentialsIn​(ClientCredentialsLocation clientCredentialsLocation)
        Define where the client credentials will be sent in the HTTP requests for the OAuth2 Dance.
        Parameters:
        clientCredentialsLocation - location of the credentials in an HTTP request.
        Returns:
        this builder
      • tokenUrl

        OAuthDancerBuilder<D> tokenUrl​(String tokenUrl)
        Mule, after receiving the authentication code from the OAuth server (through the redirectUrl) will call this url to get the access token.
        Parameters:
        tokenUrl - The OAuth authentication server url to get access to the token.
        Returns:
        this builder
      • tokenUrl

        OAuthDancerBuilder<D> tokenUrl​(org.mule.runtime.http.api.client.HttpClient httpClient,
                                       String tokenUrl)
        Mule, after receiving the authentication code from the OAuth server (through the redirectUrl) will call this url to get the access token.
        Parameters:
        httpClient - the HttpClient that will be used to do the HTTP request for the token during the OAuth dance.
        tokenUrl - The OAuth authentication server url to get access to the token.
        Returns:
        this builder
      • tokenUrl

        OAuthDancerBuilder<D> tokenUrl​(String tokenUrl,
                                       org.mule.runtime.api.tls.TlsContextFactory tlsContextFactory)
        Mule, after receiving the authentication code from the OAuth server (through the redirectUrl) will call this url to get the access token.
        Parameters:
        tokenUrl - The OAuth authentication server url to get access to the token.
        tlsContextFactory - References a TLS config that will be used to do HTTP request during the OAuth dance.
        Returns:
        this builder
      • tokenUrl

        default OAuthDancerBuilder<D> tokenUrl​(String tokenUrl,
                                               org.mule.runtime.http.api.client.proxy.ProxyConfig proxyConfig)
        Mule, after receiving the authentication code from the OAuth server (through the redirectUrl) will call this url to get the access token.
        Parameters:
        tokenUrl - The OAuth authentication server url to get access to the token.
        proxyConfig - References the proxy configuration which through the HTTP request will go during the request.
        Returns:
        this builder
      • tokenUrl

        default OAuthDancerBuilder<D> tokenUrl​(String tokenUrl,
                                               org.mule.runtime.api.tls.TlsContextFactory tlsContextFactory,
                                               org.mule.runtime.http.api.client.proxy.ProxyConfig proxyConfig)
        Mule, after receiving the authentication code from the OAuth server (through the redirectUrl) will call this url to get the access token.
        Parameters:
        tokenUrl - The OAuth authentication server url to get access to the token.
        tlsContextFactory - References a TLS config that will be used to do HTTP request during the OAuth dance.
        proxyConfig - References the proxy configuration which through the HTTP request will go during the request.
        Returns:
        this builder
      • scopes

        OAuthDancerBuilder<D> scopes​(String scopes)
        Scopes define permissions over resources.
        Parameters:
        scopes - required by this application to execute.
        Returns:
        this builder
      • encoding

        OAuthDancerBuilder<D> encoding​(Charset encoding)
        Parameters:
        encoding - the encoding to use when processing the incoming requests and responses of the OAuth dance.
        Returns:
        this builder
      • responseAccessTokenExpr

        OAuthDancerBuilder<D> responseAccessTokenExpr​(String responseAccessTokenExpr)
        Parameters:
        responseAccessTokenExpr - an expression to extract the access token parameter from the response of the call to token-url.
        Returns:
        this builder
      • responseRefreshTokenExpr

        OAuthDancerBuilder<D> responseRefreshTokenExpr​(String responseRefreshTokenExpr)
        Parameters:
        responseRefreshTokenExpr - an expression to extract the refresh token parameter from the response of the call to token-url.
        Returns:
        this builder
      • responseExpiresInExpr

        OAuthDancerBuilder<D> responseExpiresInExpr​(String responseExpiresInExpr)
        Parameters:
        responseExpiresInExpr - an expression to extract the expiresIn parameter from the response of the call to token-url.
        Returns:
        this builder
      • customParametersExtractorsExprs

        OAuthDancerBuilder<D> customParametersExtractorsExprs​(Map<String,​String> customParamsExtractorsExprs)
        Parameters:
        customParamsExtractorsExprs - a map of paramName to an expression to extract the custom parameters from the response of the call to token-url.
        Returns:
        this builder
      • resourceOwnerIdTransformer

        OAuthDancerBuilder<D> resourceOwnerIdTransformer​(Function<String,​String> resourceOwnerIdTransformer)
        Allows to partition a tokensStore and reuse it among different dancers, as long as each dancer has its own proper resourceOwnerIdStoreTransformer and ensures there can be no collissions between the transformed resourceOwnerIds for different dancers.

        Providing this transformer only affects how the dancer puts the contexts associated to a reosurceOwner in the tokensStore and the name of the locks generated from the lockProvider The un-transformed value still has to be used when calling dancer methods that receive the resourceOwnerId as a parameter, and will be used when sending data out as part of the OAuth dance or the token refresh.

        Parameters:
        resourceOwnerIdTransformer - a transformer to apply to the resourceOwnerId before using it to access the provided tokensStore.
        Returns:
        this builder
      • build

        D build()
        Uses the configuration provided to this builder to create a new dancer.
        Returns:
        a fresh instance of a dancer.