Interface OAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>
- Type Parameters:
T
- Type of the builder implementation. This parameter is used for convenience to allow better implementations of the builders implementing this interface (builder can return their own specific type instead of type defined by this interface only).
- All Known Implementing Classes:
AbstractAuthorizationCodeGrantBuilder
,AuthCodeGrantImpl.Builder
,OAuth2FlowGoogleBuilder
- Enclosing interface:
OAuth2CodeGrantFlow
public static interface OAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>
The builder of
OAuth2CodeGrantFlow
.-
Method Summary
Modifier and TypeMethodDescriptionaccessTokenUri
(String accessTokenUri) Set the access token URI on which the access token can be requested.authorizationUri
(String authorizationUri) Set the URI to which the user should be redirected to authorize our application.build()
Build theOAuth2CodeGrantFlow
instance.client
(javax.ws.rs.client.Client client) Set the client that should be used internally by theOAuth1AuthorizationFlow
to make requests to Authorization Server.clientIdentifier
(ClientIdentifier clientIdentifier) Set client identifier of the application that should be authorized.property
(OAuth2CodeGrantFlow.Phase phase, String key, String value) Set property (parameter) that will be added to requests or URIs as a query parameters during the Authorization Flow.redirectUri
(String redirectUri) Set the redirect URI to which the user (resource owner) should be redirected after he/she grants access to our application.refreshTokenUri
(String refreshTokenUri) Set the refresh token URI on which the access token can be refreshed using a refresh token.Set a scope to which the application will get authorization grant.
-
Method Details
-
accessTokenUri
Set the access token URI on which the access token can be requested. The URI points to the authorization server and is defined by the Service Provider.- Parameters:
accessTokenUri
- Access token URI.- Returns:
- Builder instance.
-
authorizationUri
Set the URI to which the user should be redirected to authorize our application. The URI points to the authorization server and is defined by the Service Provider.- Parameters:
authorizationUri
- Authorization URI.- Returns:
- Builder instance.
-
redirectUri
Set the redirect URI to which the user (resource owner) should be redirected after he/she grants access to our application. In most cases, the URI is under control of this application and request done on this URI will be used to extract query parametercode
andstate
that will be used inOAuth2CodeGrantFlow.finish(String, String)
method.If URI is not defined by this method, the default value
urn:ietf:wg:oauth:2.0:oob
will be used in the Authorization Flow which should cause thatcode
will be passed to application in other way than request redirection (for example shown to the user using html page).- Parameters:
redirectUri
- URI that should receive authorization response from the Service Provider.- Returns:
- Builder instance.
-
clientIdentifier
Set client identifier of the application that should be authorized.- Parameters:
clientIdentifier
- Client identifier.- Returns:
- Builder instance.
-
scope
Set a scope to which the application will get authorization grant. Values of this parameter are defined by the Service Provider and defines usually subset of resource and operations available in the Service Provider.The parameter is optional but ServiceProvider might require it.
- Parameters:
scope
- Scope string.- Returns:
- Builder instance.
-
client
Set the client that should be used internally by theOAuth1AuthorizationFlow
to make requests to Authorization Server. If this method is not called, it is up to the implementation to create or get any private client instance to perform these requests. This method could be used mainly for performance reasons to avoid creation of new client instances and have control about created client instances used in the application.- Parameters:
client
- Client instance.- Returns:
- Builder instance.
-
refreshTokenUri
Set the refresh token URI on which the access token can be refreshed using a refresh token. The URI points to the authorization server and is defined by the Service Provider. If the URI is not defined by this method it will be the same as URI defined inaccessTokenUri(String)
(which is the default value defined by the OAuth2 spec). Some providers do not support refreshing access tokens at all.- Parameters:
refreshTokenUri
- Refresh token URI.- Returns:
- Builder instance.
-
property
Set property (parameter) that will be added to requests or URIs as a query parameters during the Authorization Flow. Default parameters used during the Authorization Flow can be also overridden by this method.- Parameters:
phase
- Phase of the flow in which the properties (parameters) should be used. For example by using aOAuth2CodeGrantFlow.Phase.ACCESS_TOKEN_REQUEST
, the parameter will be added only to the http request for access token.key
- Property key.value
- Property value.- Returns:
- Builder instance.
-
build
OAuth2CodeGrantFlow build()Build theOAuth2CodeGrantFlow
instance.- Returns:
- New instance of
OAuth2CodeGrantFlow
.
-