10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
tenduke::oidc::DefaultOIDCBrowserFlowAuthenticationRequest Class Reference

#include <DefaultOIDCBrowserFlowAuthenticationRequest.h>

Detailed Description

Default browser-based OIDC authentication request.

Inheritance diagram for tenduke::oidc::DefaultOIDCBrowserFlowAuthenticationRequest:
tenduke::oidc::BaseOIDCRequest tenduke::oidc::OIDCBrowserFlowAuthenticationRequest tenduke::oidc::OIDCAuthenticationRequest

Public Member Functions

 DefaultOIDCBrowserFlowAuthenticationRequest (std::unique_ptr< const tenduke::oauth::OAuthBrowserAuthorizationRequest > oauthRequest, const std::shared_ptr< const tenduke::oidc::OIDCConfiguration > &oidcConfiguration, const std::string &clientId, const std::string &nonce, const std::shared_ptr< const tenduke::jwt::JWTParser > &parseJWT, const std::shared_ptr< tenduke::time::Clock > &clock)
 Constructs new instance.
std::string buildAuthenticationRequestUrl () const override
 Creates the initial authenticationrequest URL.
std::unique_ptr< tenduke::oidc::OIDCState > handleCallback (const std::string &redirectURI) const override
 Handles callback: performs consequent actions to authenticate.
Public Member Functions inherited from tenduke::oidc::BaseOIDCRequest
 BaseOIDCRequest (const std::shared_ptr< const tenduke::oidc::OIDCConfiguration > &oidcConfiguration, std::string clientId, const std::shared_ptr< const tenduke::jwt::JWTParser > &jwtParser, const std::shared_ptr< tenduke::time::Clock > &clock, std::string nonce)
 Constructs new instance.

Additional Inherited Members

Protected Member Functions inherited from tenduke::oidc::BaseOIDCRequest
virtual std::unique_ptr< tenduke::oidc::OIDCState > toOIDCState (tenduke::oauth::OAuthState &oauthState) const
 Creates OIDCState from OAuthState.
virtual tenduke::oidc::IdToken parseIdToken (const std::string &serializedIdToken, const std::string &expectedNonce) const
 Parses id token.
virtual void validateAudience (const tenduke::oidc::IdToken &idToken) const
 Validates ID-token "aud" and "azp" claims against the client id.
virtual void validateTimes (const tenduke::oidc::IdToken &idToken) const
 Validates ID-token time claims "exp" (required), "nbf" and "iat" against current time, allowing clock skew of OIDCConfiguration::allowedClockSkewS.
Static Protected Member Functions inherited from tenduke::oidc::BaseOIDCRequest
static std::vector< std::string > getAudiences (const tenduke::oidc::IdToken &idToken)
 Returns the ID-token audiences: "aud" can be a single string or an array of strings.
Protected Attributes inherited from tenduke::oidc::BaseOIDCRequest
const std::shared_ptr< const tenduke::oidc::OIDCConfiguration > oidcConfiguration
 OIDC-configuration.
const std::string clientId
 OAuth client id of this client, expected in ID-token "aud" (and "azp") claim.
const std::shared_ptr< const tenduke::jwt::JWTParser > parseJWT
 JWT parser.
const std::shared_ptr< tenduke::time::Clock > clock
 Clock for validating ID-token time claims.

Constructor & Destructor Documentation

◆ DefaultOIDCBrowserFlowAuthenticationRequest()

tenduke::oidc::DefaultOIDCBrowserFlowAuthenticationRequest::DefaultOIDCBrowserFlowAuthenticationRequest ( std::unique_ptr< const tenduke::oauth::OAuthBrowserAuthorizationRequest > oauthRequest,
const std::shared_ptr< const tenduke::oidc::OIDCConfiguration > & oidcConfiguration,
const std::string & clientId,
const std::string & nonce,
const std::shared_ptr< const tenduke::jwt::JWTParser > & parseJWT,
const std::shared_ptr< tenduke::time::Clock > & clock )

Constructs new instance.

Parameters
oauthRequest-
oidcConfiguration-
clientIdOAuth client id of this client
nonce-
parseJWT-
clockclock for validating ID-token time claims

Member Function Documentation

◆ buildAuthenticationRequestUrl()

std::string tenduke::oidc::DefaultOIDCBrowserFlowAuthenticationRequest::buildAuthenticationRequestUrl ( ) const
overridevirtual

Creates the initial authenticationrequest URL.

Navigate browser to this URL.

Returns
-

Implements tenduke::oidc::OIDCBrowserFlowAuthenticationRequest.

◆ handleCallback()

std::unique_ptr<::OIDCState > tenduke::oidc::DefaultOIDCBrowserFlowAuthenticationRequest::handleCallback ( const std::string & redirectURI) const
overridevirtual

Handles callback: performs consequent actions to authenticate.

See documentation of method tenduke::oauth::OAuthRequest::handleCallback().

The call is synchronous.

Parameters
redirectURIthis is the redirect-URI to which the OIDC server requested the browser to navigate to after the login was successful or in case of some error. The redirect-URI contains all the necessary parameters to finalize the login
Returns
state describing the login session
Exceptions
std::nested_exceptionwhen the there is some nested cause
tenduke::http::HTTPException(or subclasses of it) when the server responds with HTTP error status code which does not indicate OAuth-error, e.g. 500 (internal server error) or 404 (not found = wrong endpoint configured)
tenduke::json::JSONParsingExceptionwhen server response is not valid JSON
tenduke::oauth::OAuthExceptionwhen the server response is not what we expected, e.g.
  • problems with the redirectURI (missing or invalid "state", missing "code")
  • The token response does not contain access_token
  • The token response payload is not JSON-object
tenduke::oauth::OAuthServerErrorwhen the server responds with an error
tenduke::net::NetworkingException(or subclasses of it) when networking error occurred, e.g.
tenduke::net::URLExceptionif problem parsing the redirectURI (should not happen, though)
tenduke::net::MalformedURLExceptionif the redirectURI is invalid

Implements tenduke::oidc::OIDCBrowserFlowAuthenticationRequest.


The documentation for this class was generated from the following files: