10Duke Scale C++ Client
Loading...
Searching...
No Matches
AbstractClientFactory< P > Class Template Referenceabstract

#include <AbstractClientFactory.h>

Detailed Description

template<class P>
class AbstractClientFactory< P >

Class template for factories, which create 10Duke Scale client.

Template Parameters
Ptype of the configuration parameters

Classes

struct  OIDCServices
 Helper to return OIDCClient and OIDLogin: IdToken auth needs both. More...
 

Public Member Functions

 AbstractClientFactory (const std::string &clientId, const ::tenduke::ServiceConfiguration &serviceConfiguration)
 Constructs new instance with default services.
 
 AbstractClientFactory (const ::tenduke::TendukeServices &services)
 Constructs new instance with given services.
 
virtual std::unique_ptr<::tenduke::se::TendukeClientWithOIDCSessioncreateClient (const ::tenduke::se::ClientProperties &clientProperties, const ::tenduke::se::BackendConfiguration &backendConfiguration, const ::tenduke::oauth::OAuthBackendConfiguration &oauthBackendConfiguration, const ::tenduke::oidc::OIDCConfiguration &oidcConfiguration, const P &authenticationConfiguration, const std::string &initialStateAsJSON={}) const
 Creates client for 10Duke Scale from manually provided parameters.
 
std::unique_ptr<::tenduke::se::TendukeClientWithOIDCSessioncreateClientUsingAutodiscovery (const ::tenduke::se::ClientProperties &clientProperties, const ::tenduke::se::BackendConfiguration &backendConfiguration, const std::string &oidcAutodiscoveryURL, const P &authenticationConfiguration, const std::string &initialStateAsJSON={}) const
 Creates client for 10Duke Enterprise, using OIDC autodiscovery for OAuth and OIDC parameters.
 

Protected Member Functions

virtual std::shared_ptr<::tenduke::oauth::OAuthConfigurationmkOAuthConfiguration (const ::tenduke::oauth::OAuthBackendConfiguration &oauthBackendConfig, const P &authenticationConfig) const=0
 Creates full OAuth-configuration.
 
virtual void dumpAutodiscoveryResult (const ::tenduke::oidc::AutoDiscovery &service, const ::tenduke::oidc::AutoDiscoveryResult &result) const
 Dumps OIDC autodiscovery result to log, using DEBUG log level.
 
virtual std::unique_ptr<::tenduke::oidc::OIDCStatecreateUniqueOIDCState (const std::shared_ptr< const ::tenduke::oidc::OIDCState > &state) const
 
virtual::tenduke::se::ClientState deserializeInitialState (const std::string &initialStateAsJson) const
 
virtual OIDCServices createOIDCLoginService (const std::shared_ptr< const ::tenduke::oauth::OAuthConfiguration > &oauthConfiguration, const std::shared_ptr< const ::tenduke::oidc::OIDCConfiguration > &oidcConfiguration, const P &authenticationConfiguration) const=0
 
virtual std::shared_ptr<::tenduke::oidc::OIDCSessioncreateOIDCSessionService (const std::shared_ptr< const ::tenduke::oauth::OAuthConfiguration > &oauthConfiguration, const std::shared_ptr< const ::tenduke::oidc::OIDCConfiguration > &oidcConfiguration, const P &authenticationConfiguration, std::unique_ptr<::tenduke::oidc::OIDCState > initialState) const
 
virtual bool canUseState (const ::tenduke::se::ClientState &state) const
 Checks if stored state can be used and autodiscovery skipped.
 
virtual std::string getScope (const P &authenticationConfiguration) const
 

Protected Attributes

::tenduke::TendukeServices services
 

Constructor & Destructor Documentation

◆ AbstractClientFactory() [1/2]

template<class P>
tenduke::se::AbstractClientFactory< P >::AbstractClientFactory ( const std::string & clientId,
const ::tenduke::ServiceConfiguration & serviceConfiguration )
inline

Constructs new instance with default services.

Parameters
clientIdIdentifier of the client. Used mainly as HTTP user-agent. This value is very useful when analysing or troubleshooting activity from access logs. We recommend that value is relatively short and contains short application identifier, version and platform identifier. Use "HTTP-friendly"-characters, e.g. [0-9A-Z a-z .-_~/]. Example: the-app/1.0.0/win11
serviceConfigurationConfiguration for the underlying services. Optional.

◆ AbstractClientFactory() [2/2]

template<class P>
tenduke::se::AbstractClientFactory< P >::AbstractClientFactory ( const ::tenduke::TendukeServices & services)
inlineexplicit

Constructs new instance with given services.

This allows constructing the factory with custom services.

Parameters
services- Custom service implementation(s).

Member Function Documentation

◆ canUseState()

template<class P>
virtual bool tenduke::se::AbstractClientFactory< P >::canUseState ( const ::tenduke::se::ClientState & state) const
inlineprotectedvirtual

Checks if stored state can be used and autodiscovery skipped.

Base implementation. Subclasses should extend this to make more accurate verifications.

Parameters
state-
Returns
true if the state can be used, false otherwise

Reimplemented in BrowserAuthenticatingClientFactory, DeviceAuthenticatingClientFactory, ROPGAuthenticatingClientFactory, tenduke::se::BrowserAuthenticatingClientFactory, tenduke::se::DeviceAuthenticatingClientFactory, and tenduke::se::ROPGAuthenticatingClientFactory.

◆ createClient()

template<class P>
virtual std::unique_ptr<::tenduke::se::TendukeClientWithOIDCSession > tenduke::se::AbstractClientFactory< P >::createClient ( const ::tenduke::se::ClientProperties & clientProperties,
const ::tenduke::se::BackendConfiguration & backendConfiguration,
const ::tenduke::oauth::OAuthBackendConfiguration & oauthBackendConfiguration,
const ::tenduke::oidc::OIDCConfiguration & oidcConfiguration,
const P & authenticationConfiguration,
const std::string & initialStateAsJSON = {} ) const
inlinevirtual

Creates client for 10Duke Scale from manually provided parameters.

Parameters
clientPropertiesProperties of the client
backendConfigurationBackend configuration
oauthBackendConfigurationOAuth server configuration
oidcConfigurationOIDC-configuration
authenticationConfigurationAuthentication type specific configuration. Different authentication methods take different parameters. The concrete client factory defines the parameters it takes
initialStateAsJSONPreviously stored state, if any. Once the user has successfully logged in, the state can be persisted so that the user does not have to execute every time the application is started. If there is no previous state, pass empty string, which forces the authentication to execute on first licensing request. See TendukeClient.serializeState()
Returns
the client

◆ createClientUsingAutodiscovery()

template<class P>
std::unique_ptr<::tenduke::se::TendukeClientWithOIDCSession > tenduke::se::AbstractClientFactory< P >::createClientUsingAutodiscovery ( const ::tenduke::se::ClientProperties & clientProperties,
const ::tenduke::se::BackendConfiguration & backendConfiguration,
const std::string & oidcAutodiscoveryURL,
const P & authenticationConfiguration,
const std::string & initialStateAsJSON = {} ) const
inline

Creates client for 10Duke Enterprise, using OIDC autodiscovery for OAuth and OIDC parameters.

The OIDC autodiscovery is performed over network with a HTTP-call.

Parameters
clientPropertiesProperties of the client
backendConfigurationBackend configuration
oidcAutodiscoveryURLURL to OIDC discovery document
authenticationConfigurationAuthentication type specific configuration. Different authentication methods take different parameters. The concrete client factory defines the parameters it takes
initialStateAsJSONPreviously stored state, if any. Once the user has successfully logged in, the state can be persisted so that the user does not have to execute every time the application is started. If there is no previous state, pass empty string, which forces the authentication to execute on first licensing request. See TendukeClient.serializeState()
Returns
the client

◆ dumpAutodiscoveryResult()

template<class P>
virtual void tenduke::se::AbstractClientFactory< P >::dumpAutodiscoveryResult ( const ::tenduke::oidc::AutoDiscovery & service,
const ::tenduke::oidc::AutoDiscoveryResult & result ) const
inlineprotectedvirtual

Dumps OIDC autodiscovery result to log, using DEBUG log level.

Parameters
service-
result-

◆ mkOAuthConfiguration()

template<class P>
virtual std::shared_ptr<::tenduke::oauth::OAuthConfiguration > tenduke::se::AbstractClientFactory< P >::mkOAuthConfiguration ( const ::tenduke::oauth::OAuthBackendConfiguration & oauthBackendConfig,
const P & authenticationConfig ) const
protectedpure virtual

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