|
10Duke Enterprise C++ SDK
|
#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, std::shared_ptr< const tenduke::time::Clock > clock) | |
| 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 a signature validator. | |
| virtual std::unique_ptr< tenduke::jwk::JWKS > | getVerificationKeys (const AutoDiscoveryResult &result) const |
| Returns the verification keys 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, | ||
| std::shared_ptr< const tenduke::time::Clock > | clock ) |
Constructs new instance.
| httpClient | - |
| jsonParser | - |
| jwksParser | - |
| clock | clock for rate limiting the refreshes of the verification keys |
|
virtual |
Performs OIDC configuration auto discovery.
IMPORTANT NOTE:
In current implementation, use AutoDiscovery::toOIDCConfiguration(const AutodiscoveryResult &) to get the full OIDC-configuration including the signature validator, which uses the keys 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 | - |
| 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 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 a signature validator.
This method parses the JWKS-document, and creates a tenduke::jwk::DynamicJWKSSignatureValidator, which selects the key by the "kid" of the ID-token, and refreshes the keys from jwks_uri when it does not know the key (e.g. after the IdP has rotated its keys). The validator always uses the discovered signing algorithm, if supported. To get fully ready OIDCConfiguration, use this method instead of AutoDiscoveryResult::getOOIDCConfiguration().
| 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 |
| tenduke::oidc::OIDCException | when no verification key is found, i.e. the discovery document has no jwks_uri or the JWKS-document has no keys usable for verifying signatures |