Class GoogleService


public class GoogleService extends OidcService
OAuth service for Google as third-party authenticator.

The configuration of the service is done using properties, whose values need to match the values configured at Google.

  • google-oauth2-redirect-endpoint: the URL of the local redirect endpoint, to which the google OAuth service redirects the user after authentication. See also OidcService.getRedirectEndpoint()
  • google-oauth2-redirect-endpoint-path: optionally, the deployment path that corresponds to the redirect endpoint. See also getRedirectEndpointPath()
  • google-oauth2-client-id: The client ID
  • google-oauth2-client-secret: The client secret.

For example:


 <properties>
 <property name="google-oauth2-redirect-endpoint">
 http://localhost:8080/oauth2callback
 </property>
 <property name="google-oauth2-client-id">
 123456789012.apps.googleusercontent.com
 </property>
 <property name="google-oauth2-client-secret">
 abcdefghijk-12312312312
 </property>
 </properties>

 

Like all service classes, this class holds only configuration state. Thus, once configured, it can be safely shared between multiple sessions since its state (the configuration) is read-only.

See also: https://developers.google.com/identity/protocols/OAuth2 https://developers.google.com/identity/protocols/OpenIDConnect

  • Constructor Details

    • GoogleService

      public GoogleService(AuthService baseAuth)
      Constructor.
  • Method Details

    • configured

      public static boolean configured()
      Checks whether a GoogleAuth service is properly configured.

      This returns true if a value is found for the three configuration properties.

    • getRedirectEndpointPath

      public String getRedirectEndpointPath()
      Description copied from class: OAuthService
      Returns the deployment path of the redirection endpoint.

      This returns the path at which the static resource is deployed that corresponds to the getRedirectEndpoint().

      The default implementation will derive this path from the getRedirectEndpoint() URL.

      Overrides:
      getRedirectEndpointPath in class OAuthService