10Duke Scale C++ Client
|
#include <AutoDiscovery.h>
Service for querying OIDC configuration from known URL.
Public Member Functions | |
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. | |
virtual AutoDiscoveryResult | discover (const std::string &url) const |
Performs OIDC configuration auto discovery. | |
virtual std::string | downloadJWKSDocument (const std::string &jwks_uri) const |
Makes HTTP-call to given URL, and downloads the JWKS-document. | |
virtual std::shared_ptr< const tenduke::oidc::OIDCConfiguration > | toOIDCConfiguration (const AutoDiscoveryResult &result) const |
Returns the discovered OIDC-configuration, with default verification key. | |
virtual std::unique_ptr< tenduke::jwk::JWKS > | getVerificationKeys (const AutoDiscoveryResult &result) const |
Returns the verification keys from tenduke::oauth::oidc::AutoDiscoveryResult. | |
virtual std::unique_ptr< const tenduke::jwk::JWK > | getDefaultVerificationKey (const AutoDiscoveryResult &result) const |
Returns the default verification key from tenduke::oauth::oidc::AutoDiscoveryResult. | |
tenduke::oidc::AutoDiscovery::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.
httpClient | - |
jsonParser | - |
jwksParser | - |
|
virtual |
Performs OIDC configuration auto discovery.
IMPORTANT NOTE:
In current implementation, use AutoDiscovery::toOIDCConfiguration(const AutodiscoveryResult &) to get the full OIDC-configuration including the verification key, which is parsed from the JWKS-document.
url | full URL to the discovery document (e.g. https://genco.10duke.com/.well-known/openid-configuration) |
tenduke::crypto::CryptoException | if problems with the verification key |
tenduke::http::HTTPException | (or subclasses of it) when some HTTP-related exception (e.g. malformed URL) occurs |
tenduke::json::JSONParsingException | when server response is not valid JSON |
tenduke::oauth::oidc::OIDCException | when the server response is not what we expected, e.g.
|
tenduke::net::NetworkingException | (or subclasses of it) when networking error occurred, e.g.
|
|
virtual |
Makes HTTP-call to given URL, and downloads the JWKS-document.
jwks_uri | - |
jwks_uri
was empty. tenduke::http::HTTPException | (or subclasses of it) when some HTTP-related exception (e.g. malformed URL) occurs |
tenduke::oauth::oidc::OIDCException | when the server response is not what we expected, e.g.
|
tenduke::net::NetworkingException | (or subclasses of it) when networking error occurred, e.g.
|
|
virtual |
Returns the default verification key from tenduke::oauth::oidc::AutoDiscoveryResult.
This implementation returns first key from the JWKS "keys"-array (or nullptr if there is no JWKS-document or the "keys" array is empty).
result | - |
tenduke::crypto::CryptoException | if problems with the verification key |
tenduke::json::JSONParsingException | when the JWKS-document is not valid JSON |
tenduke::jwks::JWKSException | when the JWKS is not ok |
|
virtual |
Returns the verification keys from tenduke::oauth::oidc::AutoDiscoveryResult.
result | - |
tenduke::crypto::CryptoException | if problems with the verification key |
tenduke::json::JSONParsingException | when the JWKS-document is not valid JSON |
tenduke::jwks::JWKSException | when the JWKS is not ok |
|
virtual |
Returns the discovered OIDC-configuration, with default verification key.
This method parses the JWKS-document and extracts the default verification key. To get fully ready OIDCConfiguration, use this method instead of AutoDiscoveryResult::toOIDCConfiguration().
result | - |
tenduke::crypto::CryptoException | if problems with the verification key |
tenduke::json::JSONParsingException | when the JWKS-document is not valid JSON |
tenduke::jwks::JWKSException | when the JWKS is not ok |