10Duke Enterprise C++ Client
|
#include <DefaultLicenseTokens.h>
Default implementation of tenduke::ee::licensing::LicenseTokens
.
Public Member Functions | |
DefaultLicenseTokens (const std::shared_ptr< const tenduke::jwt::JWTParserFactory > &newJwtParser, const std::shared_ptr< const tenduke::crypto::KeyFactory > &newKey, const std::shared_ptr< const tenduke::json::JSONParser > &parseJson, const std::shared_ptr< const tenduke::crypto::PublicKey > &tokenVerificationKey) | |
Constructs new instance. | |
std::string | serialize (const std::vector< tenduke::ee::licensing::Lease > &leases) const override |
Serializes given leases to a JSON-string. | |
std::string | serialize (const std::map< std::string, tenduke::ee::licensing::Lease > &leases) const override |
Serializes given leases in map to a JSON-string. | |
std::vector< tenduke::ee::licensing::Lease > | deserialize (const std::string &serializedLeases) const override |
De-serializes given JSON string into leases. | |
tenduke::ee::licensing::impl::DefaultLicenseTokens::DefaultLicenseTokens | ( | const std::shared_ptr< const tenduke::jwt::JWTParserFactory > & | newJwtParser, |
const std::shared_ptr< const tenduke::crypto::KeyFactory > & | newKey, | ||
const std::shared_ptr< const tenduke::json::JSONParser > & | parseJson, | ||
const std::shared_ptr< const tenduke::crypto::PublicKey > & | tokenVerificationKey | ||
) |
Constructs new instance.
newJwtParser | - |
newKey | - |
parseJson | - |
tokenVerificationKey | - |
|
overridevirtual |
De-serializes given JSON string into leases.
serializedLeases | - |
Implements tenduke::ee::licensing::LicenseTokens.
|
overridevirtual |
Serializes given leases in map to a JSON-string.
leases | a map of leases, where key is the licensed item name and value is the lease |
Implements tenduke::ee::licensing::LicenseTokens.
|
overridevirtual |
Serializes given leases to a JSON-string.
This JSON can then be persisted to disk and re-loaded when the application is restarted. The JSON can then be deserialized with the LicenseTokens::deserialize(const std::string &) const
-method.
One use for the serialized leases is to use the leases even when there is no network connection.
NOTE: We strongly recommend encrypting the JSON before storing it to disk. This prevents tampering the the data. The serialized JSON contains the validation key, this is because then the tokens can be validated off-line, without e.g. having to load the validation key from the network.
NOTE: The format is not documented. You may read the JSON, but do not generate the JSON manually or modify the generated JSON.
leases | - |
Implements tenduke::ee::licensing::LicenseTokens.