Package com.iizix.server.oauth.services
Class Google
java.lang.Object
com.iizix.server.oauth.AbstractOAuthService
com.iizix.server.oauth.services.Google
- All Implemented Interfaces:
IOAuthService
The Google service.
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe Email scope: "email".static final StringThe User Public Profile scope: "profile".Fields inherited from class com.iizix.server.oauth.AbstractOAuthService
ACCEPT_LANGUAGE, accessToken, service1, service2, sessionConstructor Summary
ConstructorsConstructorDescriptionGoogle(OAuthSession session, String clientID, String clientSecret, String... scopes) Constructs the service.Method Summary
Modifier and TypeMethodDescriptionGets the approximate size in pixels of the inner browser window requested.Gets authentication provider.Returns the logout URL for the OAuth service.Gets the UserProfileInfo from this service.static IServiceCreator<Google>initialize(String clientID, String clientSecret, String... scopes) Creates an instance of theParamInitializedServicethat holds the parameters for the provider authentication.Methods inherited from class com.iizix.server.oauth.AbstractOAuthService
createServiceBuilder, dispose, disposeBlocked, disposeUserCancel, doAuthenticate, getAccessToken, getAccessToken1, getAccessToken2, getDebugOutputStream, getRequestAdditionalTime, invalidateAccessToken, validateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.iizix.comm.oauth.IOAuthService
getServiceName
Field Details
SCOPE_profile
The User Public Profile scope: "profile".- See Also:
SCOPE_email
The Email scope: "email".- See Also:
Constructor Details
Google
Constructs the service.- Parameters:
session- The OAuthSession.clientID- The Client ID.clientSecret- The Client Secret.scopes- The list of scopes as an array, or as one space delimited string. In order to retrieve the user profile information using{@link #getUserProfileInfo()}, you MUST specify the scopes{@link #SCOPE_r_liteprofile}and if you wish to also get the email address, you must also specify the scope{@link #SCOPE_r_emailaddress}.- Throws:
NullPointerException- Ifsession,clientIDorclientSecretisnull.IllegalArgumentException- IfclientIDorclientSecretis empty String.IllegalStateException- If the authentication engine is not initialized.
Method Details
initialize
public static IServiceCreator<Google> initialize(String clientID, String clientSecret, String... scopes) Creates an instance of theParamInitializedServicethat holds the parameters for the provider authentication.- Parameters:
clientID- The Client ID.clientSecret- The Client Secret.scopes- The list of scopes as an array, or as one space delimited string. In order to retrieve the user profile information using{@link #getUserProfileInfo()}, you MUST specify the scopes{@link #SCOPE_r_liteprofile}and if you wish to also get the email address, you must also specify the scope{@link #SCOPE_r_emailaddress}.- Throws:
NullPointerException- IfclientID,clientSecretor any of thescopesvalues are null isnull.IllegalArgumentException- IfclientID,clientSecretor any of thescopesvalues is empty.
getAuthenticationProvider
Gets authentication provider.- Returns:
- The authentication provider enum
AuthenticationProvider.Google.
getApproximateSize
Gets the approximate size in pixels of the inner browser window requested. This setting used when possible, but is not guaranteed.- Returns:
- The size, or null if none is known (full screen).
getLogoutURL
Returns the logout URL for the OAuth service. It is not the same as invalidating an access URL.- Specified by:
getLogoutURLin classAbstractOAuthService- Returns:
- The logout URL is
nullfor none.
getUserProfileInfo
public UserProfileInfo getUserProfileInfo() throws IOException, InterruptedException, ExecutionExceptionGets the UserProfileInfo from this service.This will cause the user to have to authenticate with the service, unless not already done.
All fields available for this service that are possible to set and available will be initialized. Other values will be left
null, unknown or undefined.- Specified by:
getUserProfileInfoin classAbstractOAuthService- Returns:
- The UserProfileInfo instance.
- Throws:
IllegalStateException- If the authentication has not completed successfully, or if the String"profile"is not among the requested scopes.ExecutionException- For execution errors.InterruptedException- If the revocation action was interrupted.IOException- For I/O errors.