Detailed Description

Basic authentication service.

This class presents an basic authentication service, which offers authentication functionality that is not specific to an authentication mechanism (such as password authentication or OAuth authentication).

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 AuthService" object is thus thread-safe.

The class provides the following services (and relevant configuration):

When authenticating using a 3rd party Identity Provider, the identity is matched against the existing users, based on the id (with AbstractUserDatabase::findWithIdentity()), or if not matched, based on whether there is a user with the same verified email address as the one indicated by the identity.

This verifies an authentication token, and considers whether it matches with a token hash value stored in database. If it matches, the token is removed and a new token is created for the identified user.

Then it uses Mail::Client to send the message, using default the default client settings.

void Wt::Auth::AuthService::setAuthTokensEnabled

(

bool

enabled,

const std::string &

cookieName = "wtauth",

const std::string &

cookieDomain = std::string()

)

Configures authentication token support.

This method allows you to configure whether authentication tokens are in use. Authentication tokens are used for the user to bypass a more elaborate authentication method, and are a secret shared with the user's user agent, usually in a cookie. They are typically presented in the user interfaces as a "remember me" option.

Whenever a valid authentication token is presented in processToken(), it is invalidated a new token is generated and stored for the user.

The tokens are generated and subsequently hashed using the token hash function. Only the hash values are stored in the user database so that a compromised user database does not compromise these tokens.