10Duke Scale C++ Client
All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
AutoDiscovery.h
1#ifndef TENDUKE_OIDC_AUTODISCOVERY_H
2#define TENDUKE_OIDC_AUTODISCOVERY_H
3
4#include "../OIDCConfiguration.h"
5
6#include "crypto/PublicKey.h"
7#include "http/HTTPClient.h"
8#include "json/JSONObject.h"
9#include "json/JSONParser.h"
10#include "jwk/JWKS.h"
11#include "jwk/JWKSParser.h"
12#include "oauth/OAuthBackendConfiguration.h"
13#include "utl/Base64Decoder.h"
14
15#include <memory>
16#include <string>
17
18namespace tenduke { namespace oidc {
19
28{
29 friend class AutoDiscovery;
30
31public:
39 std::shared_ptr<const tenduke::oauth::OAuthBackendConfiguration> oauthConfiguration,
40 std::shared_ptr<const tenduke::oidc::OIDCConfiguration> oidcConfiguration,
41 std::string jwksDocument
42 ) : oauthConfiguration(std::move(oauthConfiguration)), oidcConfiguration(std::move(oidcConfiguration)), jwksDocument(std::move(jwksDocument))
43 {}
44
49 std::shared_ptr<const tenduke::oauth::OAuthBackendConfiguration> getOAuthConfiguration() const {return oauthConfiguration;}
50
58 std::shared_ptr<const tenduke::oidc::OIDCConfiguration> getOOIDCConfiguration() const {return oidcConfiguration;}
59
60private:
61 const std::shared_ptr<const tenduke::oauth::OAuthBackendConfiguration> oauthConfiguration;
62 const std::shared_ptr<const tenduke::oidc::OIDCConfiguration> oidcConfiguration;
63 const std::string jwksDocument;
64};
65
69{
70public:
78 std::shared_ptr<const tenduke::http::HTTPClient> httpClient,
79 std::shared_ptr<const tenduke::json::JSONParser> jsonParser,
80 std::shared_ptr<const tenduke::jwk::JWKSParser> jwksParser
81 );
82
102 virtual AutoDiscoveryResult discover(const std::string &url) const;
103
115 virtual std::string downloadJWKSDocument(const std::string &jwks_uri) const;
116
128 virtual std::shared_ptr<const tenduke::oidc::OIDCConfiguration> toOIDCConfiguration(const AutoDiscoveryResult &result) const;
129
139 virtual std::unique_ptr<tenduke::jwk::JWKS> getVerificationKeys (const AutoDiscoveryResult &result) const;
140
152 virtual std::unique_ptr<const tenduke::jwk::JWK> getDefaultVerificationKey (const AutoDiscoveryResult &result) const;
153
154private:
155 const std::shared_ptr<const tenduke::http::HTTPClient> http;
156 const std::shared_ptr<const tenduke::json::JSONParser> parseJson;
157 const std::shared_ptr<const tenduke::jwk::JWKSParser> parseJWKS;
158};
159
160}}
161
162#endif // TENDUKE_OIDC_AUTODISCOVERY_H
Result of OIDC auto-configuration query.
Definition AutoDiscovery.h:28
std::shared_ptr< const tenduke::oauth::OAuthBackendConfiguration > getOAuthConfiguration() const
Returns discovered OAuth-configuration.
Definition AutoDiscovery.h:49
AutoDiscoveryResult(std::shared_ptr< const tenduke::oauth::OAuthBackendConfiguration > oauthConfiguration, std::shared_ptr< const tenduke::oidc::OIDCConfiguration > oidcConfiguration, std::string jwksDocument)
Constructs new instance.
Definition AutoDiscovery.h:38
std::shared_ptr< const tenduke::oidc::OIDCConfiguration > getOOIDCConfiguration() const
Returns the discovered OIDC-configuration WITHOUT the signing key.
Definition AutoDiscovery.h:58
Service for querying OIDC configuration from known URL.
Definition AutoDiscovery.h:69
virtual AutoDiscoveryResult discover(const std::string &url) const
Performs OIDC configuration auto discovery.
Definition AutoDiscovery.cpp:57
virtual std::shared_ptr< const tenduke::oidc::OIDCConfiguration > toOIDCConfiguration(const AutoDiscoveryResult &result) const
Returns the discovered OIDC-configuration, with default verification key.
Definition AutoDiscovery.cpp:115
virtual std::string downloadJWKSDocument(const std::string &jwks_uri) const
Makes HTTP-call to given URL, and downloads the JWKS-document.
Definition AutoDiscovery.cpp:96
AutoDiscovery(std::shared_ptr< const tenduke::http::HTTPClient > httpClient, std::shared_ptr< const tenduke::json::JSONParser > jsonParser, std::shared_ptr< const tenduke::jwk::JWKSParser > jwksParser)
Constructs new instance.
Definition AutoDiscovery.cpp:21
virtual std::unique_ptr< const tenduke::jwk::JWK > getDefaultVerificationKey(const AutoDiscoveryResult &result) const
Returns the default verification key from tenduke::oauth::oidc::AutoDiscoveryResult.
Definition AutoDiscovery.cpp:134
virtual std::unique_ptr< tenduke::jwk::JWKS > getVerificationKeys(const AutoDiscoveryResult &result) const
Returns the verification keys from tenduke::oauth::oidc::AutoDiscoveryResult.
Definition AutoDiscovery.cpp:129
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7