10Duke Scale C++ Client
All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
JWKSSignatureValidator.h
1#ifndef TENDUKE_JWK_JWKSVALIDATOR_H
2#define TENDUKE_JWK_JWKSVALIDATOR_H
3
4#include "./JWKS.h"
5#include "./JWKSDownloader.h"
6#include "../crypto/MessageDigest.h"
7#include "../jwt/JWTSignatureValidator.h"
8
9#include <memory>
10
11namespace tenduke { namespace jwk {
12
24{
25public:
38 const std::shared_ptr<tenduke::jwk::JWKS> &keySet,
39 tenduke::crypto::MessageDigest::Algorithm validationAlgorithm = tenduke::crypto::MessageDigest::Algorithm::NONE,
40 bool requireValidAlgClaim = true
41 );
42
43public:
44 bool validate(
45 const tenduke::json::JSONObject *jwtHeader,
46 const char * payload,
47 std::size_t payloadLength,
48 const unsigned char * signatureBytes,
49 std::size_t signatureLengthB
50 ) const override;
51
52protected:
58 virtual std::unique_ptr<tenduke::jwk::JWK> findJWK(const std::string &keyId) const;
59
61 virtual void mergeKeys(const tenduke::jwk::JWKS &newKeySet) const;
62
63private:
64 const std::shared_ptr<tenduke::jwk::JWKS> keySet;
71 const bool requireValidAlgClaim;
72};
73
74}}
75
76#endif //TENDUKE_JWK_JWKSVALIDATOR_H
Algorithm
Supported algorithms.
Definition MessageDigest.h:24
JSON object element.
Definition JSONObject.h:16
A tenduke::jwt::JWTSignatureValidator, which determines the validation key and algorithm based on the...
Definition JWKSSignatureValidator.h:24
JWKSSignatureValidator(const std::shared_ptr< tenduke::jwk::JWKS > &keySet, tenduke::crypto::MessageDigest::Algorithm validationAlgorithm=tenduke::crypto::MessageDigest::Algorithm::NONE, bool requireValidAlgClaim=true)
Constructs new instance.
Definition JWKSSignatureValidator.cpp:89
virtual std::unique_ptr< tenduke::jwk::JWK > findJWK(const std::string &keyId) const
Locates the key from cache by id.
Definition JWKSSignatureValidator.cpp:71
virtual void mergeKeys(const tenduke::jwk::JWKS &newKeySet) const
Merges keys from newKeySet to the contained keySet.
Definition JWKSSignatureValidator.cpp:82
bool validate(const tenduke::json::JSONObject *jwtHeader, const char *payload, std::size_t payloadLength, const unsigned char *signatureBytes, std::size_t signatureLengthB) const override
Validates JWT signature.
Definition JWKSSignatureValidator.cpp:12
JSON Web Key Set, a container for one or more tenduke::jwk::JWKs, indexed by the JWK key ID.
Definition JWKS.h:17
Service for validating the JWT-signature.
Definition JWTSignatureValidator.h:15
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7