10Duke Enterprise C++ Client
Loading...
Searching...
No Matches
tenduke::ee::licensing::impl::DefaultLicenseTokens Class Reference

#include <DefaultLicenseTokens.h>

Detailed Description

Default implementation of tenduke::ee::licensing::LicenseTokens.

Inheritance diagram for tenduke::ee::licensing::impl::DefaultLicenseTokens:
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::Leasedeserialize (const std::string &serializedLeases) const override
 De-serializes given JSON string into leases.
 

Constructor & Destructor Documentation

◆ DefaultLicenseTokens()

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.

Parameters
newJwtParser-
newKey-
parseJson-
tokenVerificationKey-

Member Function Documentation

◆ deserialize()

std::vector< xdlic::Lease > tenduke::ee::licensing::impl::DefaultLicenseTokens::deserialize ( const std::string &  serializedLeases) const
overridevirtual

De-serializes given JSON string into leases.

Parameters
serializedLeases-
Returns
-

Implements tenduke::ee::licensing::LicenseTokens.

◆ serialize() [1/2]

std::string tenduke::ee::licensing::impl::DefaultLicenseTokens::serialize ( const std::map< std::string, tenduke::ee::licensing::Lease > &  leases) const
overridevirtual

Serializes given leases in map to a JSON-string.

Parameters
leasesa map of leases, where key is the licensed item name and value is the lease
Returns
-

Implements tenduke::ee::licensing::LicenseTokens.

◆ serialize() [2/2]

std::string tenduke::ee::licensing::impl::DefaultLicenseTokens::serialize ( const std::vector< tenduke::ee::licensing::Lease > &  leases) const
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.

Parameters
leases-
Returns
-

Implements tenduke::ee::licensing::LicenseTokens.


The documentation for this class was generated from the following files: