10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
tenduke::ee::DeserializeStateFromJSON Class Reference

#include <DeserializeStateFromJSON.h>

Detailed Description

Service for deserializing client state from JSON.

Used when bootstrapping the client.

The state is read from a file or other storage, which the application or the user can modify. The ID-token of the OIDC-session is verified: the signature, the issuer and the audience. Its expiry is not checked, because a stored ID-token has typically expired, and the session refreshes it. If the ID-token does not verify, the OIDC-session is dropped, and the user has to log in again.

Public Member Functions

 DeserializeStateFromJSON (const std::shared_ptr< const ::tenduke::jwt::JWTParserFactory > &newJWTParser, const std::shared_ptr< const ::tenduke::json::JSONParser > &parseJSON, const std::shared_ptr<::tenduke::jwt::JWTSignatureValidator > &signatureValidator, std::string expectedIssuer, std::string clientId)
 Constructs new instance.
::tenduke::ee::ClientState from (const std::string &stateSerializedAsJSON) const
 Deserializes the state from JSON.

Protected Member Functions

::tenduke::ee::ClientState parseState (const ::tenduke::json::JSONObject *document) const
 Parses the state from JSON object.
::std::shared_ptr<::tenduke::oidc::OIDCState > deserializeOIDCState (const ::tenduke::json::JSONObject *oidcSession) const
 Parses OIDC-state from the state.

Constructor & Destructor Documentation

◆ DeserializeStateFromJSON()

tenduke::ee::DeserializeStateFromJSON::DeserializeStateFromJSON ( const std::shared_ptr< const ::tenduke::jwt::JWTParserFactory > & newJWTParser,
const std::shared_ptr< const ::tenduke::json::JSONParser > & parseJSON,
const std::shared_ptr<::tenduke::jwt::JWTSignatureValidator > & signatureValidator,
std::string expectedIssuer,
std::string clientId )

Constructs new instance.

Parameters
newJWTParser-
parseJSON-
signatureValidatorvalidates the signature of the ID-token, e.g. tenduke::oidc::OIDCConfiguration::signatureValidator
expectedIssuerexpected issuer of the ID-token, e.g. tenduke::oidc::OIDCConfiguration::issuer
clientIdOAuth client id of this client. The ID-token audience must contain it.
Exceptions
std::invalid_argumentif the signature validator is null

Member Function Documentation

◆ deserializeOIDCState()

std::shared_ptr<::OIDCState > tenduke::ee::DeserializeStateFromJSON::deserializeOIDCState ( const ::tenduke::json::JSONObject * oidcSession) const
protected

Parses OIDC-state from the state.

Parameters
oidcSession-
Returns
the OIDC-state, or nullptr if there is no session or its ID-token does not verify

◆ from()

ClientState tenduke::ee::DeserializeStateFromJSON::from ( const std::string & stateSerializedAsJSON) const

Deserializes the state from JSON.

Returns empty state, if the JSON does not parse or is not an object. Returns state without OIDC-session, if the ID-token of the session does not verify.

Parameters
stateSerializedAsJSON-
Returns
-

◆ parseState()

ClientState tenduke::ee::DeserializeStateFromJSON::parseState ( const ::tenduke::json::JSONObject * document) const
protected

Parses the state from JSON object.

Parameters
document-
Returns
-

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