Module org.mule.oauth.client.api
Interface OAuthDancerBuilder<D>
-
- All Known Subinterfaces:
OAuthAuthorizationCodeDancerBuilder,OAuthClientCredentialsDancerBuilder
public interface OAuthDancerBuilder<D>Builder that allows to configure the common attributes for any grant type.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Dbuild()Uses the configuration provided to this builder to create a new dancer.OAuthDancerBuilder<D>clientCredentials(String clientId, String clientSecret)OAuthDancerBuilder<D>customParametersExtractorsExprs(Map<String,String> customParamsExtractorsExprs)OAuthDancerBuilder<D>encoding(Charset encoding)default OAuthDancerBuilder<D>name(String name)OAuthDancerBuilder<D>resourceOwnerIdTransformer(Function<String,String> resourceOwnerIdTransformer)Allows to partition atokensStoreand reuse it among different dancers, as long as each dancer has its own properresourceOwnerIdStoreTransformerand ensures there can be no collissions between the transformedresourceOwnerIdsfor different dancers.OAuthDancerBuilder<D>responseAccessTokenExpr(String responseAccessTokenExpr)OAuthDancerBuilder<D>responseExpiresInExpr(String responseExpiresInExpr)OAuthDancerBuilder<D>responseRefreshTokenExpr(String responseRefreshTokenExpr)OAuthDancerBuilder<D>scopes(String scopes)Scopes define permissions over resources.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.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.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.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.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.default OAuthDancerBuilder<D>withClientCredentialsIn(ClientCredentialsLocation clientCredentialsLocation)Define where the client credentials will be sent in the HTTP requests for the OAuth2 Dance.
-
-
-
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- theHttpClientthat 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 theaccess tokenparameter from the response of the call totoken-url.- Returns:
- this builder
-
responseRefreshTokenExpr
OAuthDancerBuilder<D> responseRefreshTokenExpr(String responseRefreshTokenExpr)
- Parameters:
responseRefreshTokenExpr- an expression to extract therefresh tokenparameter from the response of the call totoken-url.- Returns:
- this builder
-
responseExpiresInExpr
OAuthDancerBuilder<D> responseExpiresInExpr(String responseExpiresInExpr)
- Parameters:
responseExpiresInExpr- an expression to extract theexpiresInparameter from the response of the call totoken-url.- Returns:
- this builder
-
customParametersExtractorsExprs
OAuthDancerBuilder<D> customParametersExtractorsExprs(Map<String,String> customParamsExtractorsExprs)
- Parameters:
customParamsExtractorsExprs- a map ofparamNameto an expression to extract the custom parameters from the response of the call totoken-url.- Returns:
- this builder
-
resourceOwnerIdTransformer
OAuthDancerBuilder<D> resourceOwnerIdTransformer(Function<String,String> resourceOwnerIdTransformer)
Allows to partition atokensStoreand reuse it among different dancers, as long as each dancer has its own properresourceOwnerIdStoreTransformerand ensures there can be no collissions between the transformedresourceOwnerIdsfor different dancers.Providing this transformer only affects how the dancer puts the contexts associated to a
reosurceOwnerin thetokensStoreand the name of the locks generated from thelockProviderThe un-transformed value still has to be used when calling dancer methods that receive theresourceOwnerIdas 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 theresourceOwnerIdbefore using it to access the providedtokensStore.- 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.
-
-