Class OAuth2FlowGoogleBuilder
- java.lang.Object
-
- org.glassfish.jersey.client.oauth2.OAuth2FlowGoogleBuilder
-
- All Implemented Interfaces:
OAuth2CodeGrantFlow.Builder<OAuth2FlowGoogleBuilder>
public class OAuth2FlowGoogleBuilder extends Object
Class that provides methods to buildOAuth2CodeGrantFlowpre-configured for usage with Google provider.- Since:
- 2.3
- Author:
- Miroslav Fuksa
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOAuth2FlowGoogleBuilder.AccessTypeEnum that defines values for "access_type" parameter used in Google OAuth flow.static classOAuth2FlowGoogleBuilder.DisplayEnum that defines values for "display" parameter used in Google OAuth flow.static classOAuth2FlowGoogleBuilder.PromptEnum that defines values for "prompt" parameter used in Google OAuth flow.
-
Field Summary
Fields Modifier and Type Field Description static StringLOGIN_HINTProperty key that defines values for "login_hint" parameter used in Google OAuth flow.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TaccessTokenUri(String accessTokenUri)Set the access token URI on which the access token can be requested.OAuth2FlowGoogleBuilderaccessType(OAuth2FlowGoogleBuilder.AccessType accessType)Setaccess typeparameter used in Authorization Request.TauthorizationUri(String authorizationUri)Set the URI to which the user should be redirected to authorize our application.OAuth2CodeGrantFlowbuild()Build theOAuth2CodeGrantFlowinstance.Tclient(Client client)Set the client that should be used internally by theOAuth1AuthorizationFlowto make requests to Authorization Server.TclientIdentifier(ClientIdentifier consumerCredentials)Set client identifier of the application that should be authorized.OAuth2FlowGoogleBuilderdisplay(OAuth2FlowGoogleBuilder.Display display)Setdisplayparameter used in Authorization Request.OAuth2FlowGoogleBuilderloginHint(String loginHint)Setlogin hintparameter used in Authorization Request.OAuth2FlowGoogleBuilderprompt(OAuth2FlowGoogleBuilder.Prompt prompt)Setpromptparameter used in Authorization Request.Tproperty(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.TredirectUri(String redirectUri)Set the redirect URI to which the user (resource owner) should be redirected after he/she grants access to our application.TrefreshTokenUri(String refreshTokenUri)Set the refresh token URI on which the access token can be refreshed using a refresh token.Tscope(String scope)Set a scope to which the application will get authorization grant.
-
-
-
Field Detail
-
LOGIN_HINT
public static final String LOGIN_HINT
Property key that defines values for "login_hint" parameter used in Google OAuth flow.- See Also:
- Constant Field Values
-
-
Method Detail
-
accessType
public OAuth2FlowGoogleBuilder accessType(OAuth2FlowGoogleBuilder.AccessType accessType)
Setaccess typeparameter used in Authorization Request.- Parameters:
accessType- access type value.- Returns:
- a google authorization flow builder.
-
prompt
public OAuth2FlowGoogleBuilder prompt(OAuth2FlowGoogleBuilder.Prompt prompt)
Setpromptparameter used in Authorization Request.- Parameters:
prompt- Prompt value.- Returns:
- a google authorization flow builder.
-
display
public OAuth2FlowGoogleBuilder display(OAuth2FlowGoogleBuilder.Display display)
Setdisplayparameter used in Authorization Request.- Parameters:
display- display value.- Returns:
- a google authorization flow builder.
-
loginHint
public OAuth2FlowGoogleBuilder loginHint(String loginHint)
Setlogin hintparameter used in Authorization Request.- Parameters:
loginHint- login hint value.- Returns:
- a google authorization flow builder.
-
accessTokenUri
public T accessTokenUri(String accessTokenUri)
Description copied from interface:OAuth2CodeGrantFlow.BuilderSet 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.- Specified by:
accessTokenUriin interfaceOAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>- Parameters:
accessTokenUri- Access token URI.- Returns:
- Builder instance.
-
authorizationUri
public T authorizationUri(String authorizationUri)
Description copied from interface:OAuth2CodeGrantFlow.BuilderSet 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.- Specified by:
authorizationUriin interfaceOAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>- Parameters:
authorizationUri- Authorization URI.- Returns:
- Builder instance.
-
redirectUri
public T redirectUri(String redirectUri)
Description copied from interface:OAuth2CodeGrantFlow.BuilderSet 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 parametercodeandstatethat 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:oobwill be used in the Authorization Flow which should cause thatcodewill be passed to application in other way than request redirection (for example shown to the user using html page).- Specified by:
redirectUriin interfaceOAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>- Parameters:
redirectUri- URI that should receive authorization response from the Service Provider.- Returns:
- Builder instance.
-
clientIdentifier
public T clientIdentifier(ClientIdentifier consumerCredentials)
Description copied from interface:OAuth2CodeGrantFlow.BuilderSet client identifier of the application that should be authorized.- Specified by:
clientIdentifierin interfaceOAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>- Parameters:
consumerCredentials- Client identifier.- Returns:
- Builder instance.
-
scope
public T scope(String scope)
Description copied from interface:OAuth2CodeGrantFlow.BuilderSet 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.
- Specified by:
scopein interfaceOAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>- Parameters:
scope- Scope string.- Returns:
- Builder instance.
-
client
public T client(Client client)
Description copied from interface:OAuth2CodeGrantFlow.BuilderSet the client that should be used internally by theOAuth1AuthorizationFlowto 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.- Specified by:
clientin interfaceOAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>- Parameters:
client- Client instance.- Returns:
- Builder instance.
-
refreshTokenUri
public T refreshTokenUri(String refreshTokenUri)
Description copied from interface:OAuth2CodeGrantFlow.BuilderSet 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 inOAuth2CodeGrantFlow.Builder.accessTokenUri(String)(which is the default value defined by the OAuth2 spec). Some providers do not support refreshing access tokens at all.- Specified by:
refreshTokenUriin interfaceOAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>- Parameters:
refreshTokenUri- Refresh token URI.- Returns:
- Builder instance.
-
property
public T property(OAuth2CodeGrantFlow.Phase phase, String key, String value)
Description copied from interface:OAuth2CodeGrantFlow.BuilderSet 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.- Specified by:
propertyin interfaceOAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>- 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
public OAuth2CodeGrantFlow build()
Description copied from interface:OAuth2CodeGrantFlow.BuilderBuild theOAuth2CodeGrantFlowinstance.- Specified by:
buildin interfaceOAuth2CodeGrantFlow.Builder<T extends OAuth2CodeGrantFlow.Builder>- Returns:
- New instance of
OAuth2CodeGrantFlow.
-
-