Wt
4.11.1
|
An OpenId Connect authentication service provider. More...
#include <Wt/Auth/OidcService.h>
Public Member Functions | |
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< OAuthProcess > | createProcess (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 AuthService & | baseAuth () 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 | redirectEndpointPath () const |
Returns the deployment path of the redirection endpoint. More... | |
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... | |
An OpenId Connect authentication service provider.
This class implements an OpenID Connect client (core specification), which can be used to allow the user to be safely authenticated with your web application without needing to store or even handle his authorization credentials (such as a password).
OpenID Connect is a simple identity layer on top of the OAuth 2.0 protocol. It enables Clients to verify the identity of the End-User based on the authentication performed by an Authorization Server, as well as to obtain basic profile information about the End-User in an interoperable and REST-like manner.
This implementation only supports authentication using the Authorization Code Flow.
The configuration of this service is done by using the setters the service class exposes. Before the authentication process can be started these settings must be configured first and may not be changed afterwards. A "const OidcService" object is thread-safe.
The OpenID Connect protocol, including the subsequent use for authentication, consists of a number of consecutive steps, some of which require user interaction, and some which require the use of remote web services. The state machine for this process is implemented in an OidcProcess. To use OpenID Connect, you need to create such a process and listen for state changes.
|
overridevirtual |
Returns the scope needed for authentication.
This returns the scope that is needed (and sufficient) for obtaining identity information, and thus to authenticate the user.
This defaults to "openid".
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Returns the authorization endpoint URL.
This is a remote URL which hosts the OpenID Connect authorization user interface. This URL is loaded in the popup window at the start of an authorization process.
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Returns the client ID.
This is the identification for this web application with the OpenID Connect provider.
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Returns the client secret.
This is the secret credentials for this web application with the OpenID Connect provider.
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Returns the method to transfer the client secret.
The default implementation returns HttpAuthorizationBasic (the recommended method).
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Creates a new authentication process.
This creates a new authentication process for the indicated scope. Valid names for the scope are service provider dependent.
The service needs to be correctly configured before being able to call this function. configure() needs to be called first to check if the configuration is valid.
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Returns the provider description.
This returns a description useful for e.g. tool tips on a login icon.
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Returns the provider name.
This is a short identifier.
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Returns the desired height of the popup window.
Defaults to 400 pixels.
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Returns the desired width for the popup window.
Defaults to 670 pixels.
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Returns the redirection endpoint URL.
This is the local URL to which the browser is redirect from the service provider, after the authorization process. You need to configure this URL with the third party authentication service.
A static resource will be deployed at this URL.
Implements Wt::Auth::OAuthService.
void Wt::Auth::OidcService::setAuthEndpoint | ( | const std::string & | url | ) |
void Wt::Auth::OidcService::setAuthenticationScope | ( | const std::string & | scope | ) |
void Wt::Auth::OidcService::setClientId | ( | const std::string & | id | ) |
void Wt::Auth::OidcService::setClientSecret | ( | const std::string & | secret | ) |
void Wt::Auth::OidcService::setClientSecretMethod | ( | ClientSecretMethod | method | ) |
Sets the method to transfer the client secret.
void Wt::Auth::OidcService::setDescription | ( | const std::string & | description | ) |
void Wt::Auth::OidcService::setName | ( | const std::string & | name | ) |
Sets the provider name.
void Wt::Auth::OidcService::setPopupHeight | ( | int | height | ) |
Sets the desired height for the popup window.
void Wt::Auth::OidcService::setPopupWidth | ( | int | width | ) |
Sets the desired width for the popup window.
void Wt::Auth::OidcService::setRedirectEndpoint | ( | const std::string & | url | ) |
Sets the redirection endpoint URL.
void Wt::Auth::OidcService::setTokenEndpoint | ( | const std::string & | url | ) |
void Wt::Auth::OidcService::setUserInfoEndpoint | ( | const std::string & | url | ) |
|
overridevirtual |
Returns the token endpoint URL.
This is a remote URL which hosts a web-service that generates access and id tokens.
Implements Wt::Auth::OAuthService.
|
overridevirtual |
Returns the user info endpoint URL.
This is a remote URL which hosts a web-service that provides the claims that are associated with the requested scope.
Reimplemented from Wt::Auth::OAuthService.