Wt  4.11.1
Public Member Functions | Static Public Member Functions | List of all members
Wt::Auth::GoogleService Class Reference

OAuth service for Google as third-party authenticator. More...

#include <GoogleService.h>

Inheritance diagram for Wt::Auth::GoogleService:
[legend]

Public Member Functions

 GoogleService (const AuthService &baseAuth)
 Constructor.
 
virtual std::string redirectEndpointPath () const override
 Returns the deployment path of the redirection endpoint. More...
 
- Public Member Functions inherited from Wt::Auth::OidcService
 OidcService (const AuthService &baseAuth)
 Constructor.
 
virtual std::string name () const override
 Returns the provider name. More...
 
virtual WString description () const override
 Returns the provider description. More...
 
virtual int popupWidth () const override
 Returns the desired width for the popup window. More...
 
virtual int popupHeight () const override
 Returns the desired height of the popup window. More...
 
virtual std::string authenticationScope () const override
 Returns the scope needed for authentication. More...
 
virtual std::string redirectEndpoint () const override
 Returns the redirection endpoint URL. More...
 
virtual std::string authorizationEndpoint () const override
 Returns the authorization endpoint URL. More...
 
virtual std::string tokenEndpoint () const override
 Returns the token endpoint URL. More...
 
virtual std::string userInfoEndpoint () const override
 Returns the user info endpoint URL. More...
 
virtual std::string clientId () const override
 Returns the client ID. More...
 
virtual std::string clientSecret () const override
 Returns the client secret. More...
 
virtual ClientSecretMethod clientSecretMethod () const override
 Returns the method to transfer the client secret. More...
 
virtual std::unique_ptr< OAuthProcesscreateProcess (const std::string &scope) const override
 Creates a new authentication process. More...
 
void setRedirectEndpoint (const std::string &url)
 Sets the redirection endpoint URL. More...
 
void setClientId (const std::string &id)
 Sets the client ID. More...
 
void setClientSecret (const std::string &secret)
 Sets the client secret. More...
 
void setAuthEndpoint (const std::string &url)
 Sets the authorization endpoint URL. More...
 
void setTokenEndpoint (const std::string &url)
 Sets the token endpoint URL. More...
 
void setUserInfoEndpoint (const std::string &url)
 Sets the user info endpoint URL. More...
 
void setAuthenticationScope (const std::string &scope)
 Sets the scope needed for authentication. More...
 
void setName (const std::string &name)
 Sets the provider name. More...
 
void setDescription (const std::string &description)
 Sets the provider description. More...
 
void setClientSecretMethod (ClientSecretMethod method)
 Sets the method to transfer the client secret. More...
 
void setPopupWidth (int width)
 Sets the desired width for the popup window. More...
 
void setPopupHeight (int height)
 Sets the desired height for the popup window. More...
 
- Public Member Functions inherited from Wt::Auth::OAuthService
 OAuthService (const AuthService &baseAuth)
 Constructor. More...
 
virtual ~OAuthService ()
 Destructor.
 
const AuthServicebaseAuth () const
 Returns the basic authentication service.
 
void setPopupEnabled (bool enable)
 Configure if a popup should be used for the login. More...
 
bool popupEnabled () const
 Returns if a popup is used for the login.
 
virtual std::string encodeState (const std::string &sessionId) const
 Derives a state value from the session ID. More...
 
virtual std::string decodeState (const std::string &state) const
 Validates and decodes a state parameter. More...
 
virtual Http::Method tokenRequestMethod () const
 Returns the HTTP method used for the token request. More...
 
void configureRedirectEndpoint () const
 Configures the static resource implementing the redirect endpoint. More...
 

Static Public Member Functions

static bool configured ()
 Checks whether a GoogleAuth service is properly configured. More...
 

Detailed Description

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.

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>
virtual std::string name() const override
Returns the provider name.
Definition: OidcService.h:124

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. A "const GoogleService" object is thus thread-safe.

See also
https://developers.google.com/identity/protocols/OAuth2
https://developers.google.com/identity/protocols/OpenIDConnect
Note
For FastCGI, see also additional configuration in OAuthService

Member Function Documentation

◆ configured()

bool Wt::Auth::GoogleService::configured ( )
static

Checks whether a GoogleAuth service is properly configured.

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

◆ redirectEndpointPath()

std::string Wt::Auth::GoogleService::redirectEndpointPath ( ) const
overridevirtual

Returns the deployment path of the redirection endpoint.

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

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

Reimplemented from Wt::Auth::OAuthService.