Module org.mule.oauth.client.api
Interface OAuthAuthorizationCodeDancerBuilder
-
- All Superinterfaces:
OAuthDancerBuilder<AuthorizationCodeOAuthDancer>
@NoImplement public interface OAuthAuthorizationCodeDancerBuilder extends OAuthDancerBuilder<AuthorizationCodeOAuthDancer>
Builder that allows to configure the attributes for the authorization code grant type.- Since:
- 1.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description OAuthAuthorizationCodeDancerBuilderaddAdditionalRefreshTokenRequestHeaders(org.mule.runtime.api.util.MultiMap<String,String> additionalHeaders)Adds additional request headers for refreshing the tokenOAuthAuthorizationCodeDancerBuilderaddAdditionalRefreshTokenRequestParameters(org.mule.runtime.api.util.MultiMap<String,String> additionalParameters)Adds additional request parameters for refreshing the tokenOAuthAuthorizationCodeDancerBuilderaddListener(AuthorizationCodeListener listener)Adds the providedlistenerOAuthAuthorizationCodeDancerBuilderafterDanceCallback(BiConsumer<AuthorizationCodeDanceCallbackContext,ResourceOwnerOAuthContext> callback)Allows custom code to be run after doing the request to the providedtokenUrland processing its results.OAuthAuthorizationCodeDancerBuilderauthorizationUrl(String authorizationUrl)OAuthAuthorizationCodeDancerBuilderbeforeDanceCallback(Function<AuthorizationCodeRequest,AuthorizationCodeDanceCallbackContext> callback)Allows custom code to be run just before doing the request to the providedtokenUrl.OAuthAuthorizationCodeDancerBuildercustomBodyParameters(Supplier<Map<String,String>> customBodyParameters)Adds thecustomBodyParametersto the body of the token url request.OAuthAuthorizationCodeDancerBuildercustomBodyParameters(Map<String,String> customBodyParameters)Adds thecustomBodyParametersto the body of the token url request.OAuthAuthorizationCodeDancerBuildercustomHeaders(Supplier<Map<String,String>> customHeaders)There are OAuth implementations that require or allow extra headers to be sent when calling the Authentication URL of the OAS.OAuthAuthorizationCodeDancerBuildercustomHeaders(Map<String,String> customHeaders)There are OAuth implementations that require or allow extra headers to be sent when calling the Authentication URL of the OAS.OAuthAuthorizationCodeDancerBuildercustomParameters(Supplier<Map<String,String>> customParameters)There are OAuth implementations that require or allow extra query parameters to be sent when calling the Authentication URL of the OAS.OAuthAuthorizationCodeDancerBuildercustomParameters(Map<String,String> customParameters)There are OAuth implementations that require or allow extra query parameters to be sent when calling the Authentication URL of the OAS.default OAuthAuthorizationCodeDancerBuilderencodeClientCredentialsInBody(boolean encodeClientCredentialsInBody)Deprecated.since 4.2.0.OAuthAuthorizationCodeDancerBuilderexternalCallbackUrl(String externalCallbackUrl)The oauth authentication server will use this url to provide the authentication code to the Mule server so the mule server can retrieve the access token.OAuthAuthorizationCodeDancerBuilderincludeRedirectUriInRefreshTokenRequest(boolean includeRedirectUriInRefreshTokenRequest)Allows to toggle the inclusion of a redirect_uri parameter on the refresh token request.OAuthAuthorizationCodeDancerBuilderlocalAuthorizationUrlPath(String path)If this attribute is provided mule will automatically create and endpoint in the host server (the same configured forlocalCallback(java.net.URL)) that the user can hit to authenticate and grant access to the application for his account.OAuthAuthorizationCodeDancerBuilderlocalAuthorizationUrlResourceOwnerId(String localAuthorizationUrlResourceOwnerIdExpr)This attribute is only required when the applications needs to access resources from more than one user in the OAuth authentication server.OAuthAuthorizationCodeDancerBuilderlocalCallback(URL localCallbackUrl)The producedAuthorizationCodeOAuthDancerwill create anHttpServerto listen on the providedlocalCallbackUrl.OAuthAuthorizationCodeDancerBuilderlocalCallback(URL localCallbackUrl, org.mule.runtime.api.tls.TlsContextFactory tlsContextFactory)The producedAuthorizationCodeOAuthDancerwill create anHttpServerwith the providedtlsContextFactoryto listen on the providedlocalCallbackUrl.OAuthAuthorizationCodeDancerBuilderlocalCallback(org.mule.runtime.http.api.server.HttpServer server, String localCallbackConfigPath)The producedAuthorizationCodeOAuthDancerwill use an existingHttpServerto listen on the providedlocalCallbackConfigPath.OAuthAuthorizationCodeDancerBuilderstate(String stateExpr)Mule will add some internal stuff to the state that is sent to the Authorization server.-
Methods inherited from interface org.mule.oauth.client.api.builder.OAuthDancerBuilder
build, clientCredentials, customParametersExtractorsExprs, encoding, name, resourceOwnerIdTransformer, responseAccessTokenExpr, responseExpiresInExpr, responseRefreshTokenExpr, scopes, tokenUrl, tokenUrl, tokenUrl, tokenUrl, tokenUrl, withClientCredentialsIn
-
-
-
-
Method Detail
-
encodeClientCredentialsInBody
@Deprecated default OAuthAuthorizationCodeDancerBuilder encodeClientCredentialsInBody(boolean encodeClientCredentialsInBody)
Deprecated.since 4.2.0. UseOAuthDancerBuilder.withClientCredentialsIn(ClientCredentialsLocation)instead.- Parameters:
encodeClientCredentialsInBody- If @{code true}, the client id and client secret will be sent in the request body. Otherwise, they will be sent as basic authentication.- Returns:
- this builder
-
localCallback
OAuthAuthorizationCodeDancerBuilder localCallback(URL localCallbackUrl)
The producedAuthorizationCodeOAuthDancerwill create anHttpServerto listen on the providedlocalCallbackUrl.- Parameters:
localCallbackUrl- the url to listen on- Returns:
- this builder
-
localCallback
OAuthAuthorizationCodeDancerBuilder localCallback(URL localCallbackUrl, org.mule.runtime.api.tls.TlsContextFactory tlsContextFactory)
The producedAuthorizationCodeOAuthDancerwill create anHttpServerwith the providedtlsContextFactoryto listen on the providedlocalCallbackUrl.- Parameters:
localCallbackUrl- the url to listen ontlsContextFactory- the TLS context to use for the listener- Returns:
- this builder
-
localCallback
OAuthAuthorizationCodeDancerBuilder localCallback(org.mule.runtime.http.api.server.HttpServer server, String localCallbackConfigPath)
The producedAuthorizationCodeOAuthDancerwill use an existingHttpServerto listen on the providedlocalCallbackConfigPath.- Parameters:
server- a server listening on a specific host and portlocalCallbackConfigPath- the path on theserverto listen on- Returns:
- this builder
-
localAuthorizationUrlPath
OAuthAuthorizationCodeDancerBuilder localAuthorizationUrlPath(String path)
If this attribute is provided mule will automatically create and endpoint in the host server (the same configured forlocalCallback(java.net.URL)) that the user can hit to authenticate and grant access to the application for his account.- Parameters:
path- the path to listen for the callback- Returns:
- this builder
-
localAuthorizationUrlResourceOwnerId
OAuthAuthorizationCodeDancerBuilder localAuthorizationUrlResourceOwnerId(String localAuthorizationUrlResourceOwnerIdExpr)
This attribute is only required when the applications needs to access resources from more than one user in the OAuth authentication server.- Parameters:
localAuthorizationUrlResourceOwnerIdExpr- expression to get the identifier under which the oauth authentication attributes are stored (accessToken, refreshToken, etc).- Returns:
- this builder
-
customParameters
OAuthAuthorizationCodeDancerBuilder customParameters(Map<String,String> customParameters)
There are OAuth implementations that require or allow extra query parameters to be sent when calling the Authentication URL of the OAS.Invoking this method overrides any prior invokations to
customParameters(Supplier)- Parameters:
customParameters- the extra parameters to be sent with the authorization request toauthorizationUrl(String).- Returns:
- this builder
-
customParameters
OAuthAuthorizationCodeDancerBuilder customParameters(Supplier<Map<String,String>> customParameters)
There are OAuth implementations that require or allow extra query parameters to be sent when calling the Authentication URL of the OAS.Invoking this method overrides any prior invocations to
customParameters(Map)- Parameters:
customParameters- ASupplierthe extra parameters to be sent with the authorization request toauthorizationUrl(String).- Returns:
- this builder
-
customHeaders
OAuthAuthorizationCodeDancerBuilder customHeaders(Map<String,String> customHeaders)
There are OAuth implementations that require or allow extra headers to be sent when calling the Authentication URL of the OAS.Invoking this method overrides any prior invocations to
customHeaders(Supplier)- Parameters:
customHeaders- the extra headers to be sent with the authorization request toauthorizationUrl(String).- Returns:
- this builder
-
customHeaders
OAuthAuthorizationCodeDancerBuilder customHeaders(Supplier<Map<String,String>> customHeaders)
There are OAuth implementations that require or allow extra headers to be sent when calling the Authentication URL of the OAS.Invoking this method overrides any prior invocations to
customParameters(Map)- Parameters:
customHeaders- ASupplierthe extra headers to be sent with the authorization request toauthorizationUrl(String).- Returns:
- this builder
-
customBodyParameters
OAuthAuthorizationCodeDancerBuilder customBodyParameters(Map<String,String> customBodyParameters)
Adds thecustomBodyParametersto the body of the token url request.- Parameters:
customBodyParameters- the custom parameters- Returns:
thisbuilder- Throws:
IllegalArgumentException- ifcustomBodyParametersisnull- Since:
- 2.0.0
-
customBodyParameters
OAuthAuthorizationCodeDancerBuilder customBodyParameters(Supplier<Map<String,String>> customBodyParameters)
Adds thecustomBodyParametersto the body of the token url request.- Parameters:
customBodyParameters- aSupplierfor the custom parameters- Returns:
thisbuilder- Throws:
IllegalArgumentException- ifcustomBodyParametersisnull- Since:
- 2.0.0
-
state
OAuthAuthorizationCodeDancerBuilder state(String stateExpr)
Mule will add some internal stuff to the state that is sent to the Authorization server. When the callback is received, those will be removed to be processed, and thestateas specified in this method will be honored.- Parameters:
stateExpr- parameter for holding state between the authentication request and the callback done by the OAuth authorization server to theexternalCallbackUrl(String).- Returns:
- this builder
-
authorizationUrl
OAuthAuthorizationCodeDancerBuilder authorizationUrl(String authorizationUrl)
- Parameters:
authorizationUrl- The OAuth authentication server url to authorize the app for a certain user.- Returns:
- this builder
-
externalCallbackUrl
OAuthAuthorizationCodeDancerBuilder externalCallbackUrl(String externalCallbackUrl)
The oauth authentication server will use this url to provide the authentication code to the Mule server so the mule server can retrieve the access token.Note: this must be the externally visible address of the
localCallback(java.net.URL).TODO MULE-11861: Allow to infer the localCallback url based on the externalCallbackUrl for Auth-code grant-type
- Parameters:
externalCallbackUrl- the callback url where the authorization code will be received.- Returns:
- this builder
-
beforeDanceCallback
OAuthAuthorizationCodeDancerBuilder beforeDanceCallback(Function<AuthorizationCodeRequest,AuthorizationCodeDanceCallbackContext> callback)
Allows custom code to be run just before doing the request to the providedtokenUrl.The map returned by the provided function will be passed to the
afterDanceCallback(BiConsumer), if set.- Parameters:
callback- aFunctionthat receives the parameters that will be used in the executing dance and returns anAuthorizationCodeDanceCallbackContextto be then passed to theafterDanceCallback(BiConsumer). Not null.- Returns:
- this builder
-
afterDanceCallback
OAuthAuthorizationCodeDancerBuilder afterDanceCallback(BiConsumer<AuthorizationCodeDanceCallbackContext,ResourceOwnerOAuthContext> callback)
Allows custom code to be run after doing the request to the providedtokenUrland processing its results.- Parameters:
callback- aBiConsumerthat receives theAuthorizationCodeDanceCallbackContextreturned by the callback passed tobeforeDanceCallback(Function)and the OAuth context from the response of the call totokenUrl. Not null.- Returns:
- this builder
-
addListener
OAuthAuthorizationCodeDancerBuilder addListener(AuthorizationCodeListener listener)
Adds the providedlistener- Parameters:
listener- aAuthorizationCodeListener- Returns:
thisbuilder- Throws:
IllegalArgumentException- if thelistenerisnull
-
addAdditionalRefreshTokenRequestParameters
OAuthAuthorizationCodeDancerBuilder addAdditionalRefreshTokenRequestParameters(org.mule.runtime.api.util.MultiMap<String,String> additionalParameters)
Adds additional request parameters for refreshing the token- Parameters:
additionalParameters- aMapthat contains the additional parameters to be included- Returns:
thisbuilder- Since:
- 1.0
-
addAdditionalRefreshTokenRequestHeaders
OAuthAuthorizationCodeDancerBuilder addAdditionalRefreshTokenRequestHeaders(org.mule.runtime.api.util.MultiMap<String,String> additionalHeaders)
Adds additional request headers for refreshing the token- Parameters:
additionalHeaders- aMapthat contains the additional headers to be included- Returns:
thisbuilder- Since:
- 1.0
-
includeRedirectUriInRefreshTokenRequest
OAuthAuthorizationCodeDancerBuilder includeRedirectUriInRefreshTokenRequest(boolean includeRedirectUriInRefreshTokenRequest)
Allows to toggle the inclusion of a redirect_uri parameter on the refresh token request. The parameter is included by default.- Parameters:
includeRedirectUriInRefreshTokenRequest- abooleanthat decides if the parameter should be sent or not- Returns:
thisbuilder- Since:
- 1.0
-
-