10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
DefaultOfflineLicenseTokenParser Class Reference
Inheritance diagram for DefaultOfflineLicenseTokenParser:
tenduke::ee::licensing::OfflineLicenseTokenParser

Public Member Functions

 DefaultOfflineLicenseTokenParser (const std::shared_ptr< const ::tenduke::jwt::JWTParser > &jwtParser)
::tenduke::ee::licensing::Lease from (const std::string &licenseToken, const std::string &licensedItemName) const override
 Parses a single token of the given licensed item from given string.
::tenduke::ee::licensing::Lease from (const std::string &licenseToken) const override
 Parses a single token from given string, guessing the licensed item name.

Additional Inherited Members

Static Public Member Functions inherited from tenduke::ee::licensing::OfflineLicenseTokenParser
static std::unique_ptr< OfflineLicenseTokenParser > create (const std::string &validationKeyPEM)

Member Function Documentation

◆ from() [1/2]

Lease tenduke::ee::licensing::impl::DefaultOfflineLicenseTokenParser::from ( const std::string & licenseToken) const
overridevirtual

Parses a single token from given string, guessing the licensed item name.

The licensed item name is guessed: it is the only claim with value true, which is not a well-known claim. Prefer from(licenseToken, licensedItemName) for licensing decisions, and always check the name of the returned lease.

Parameters
licenseTokenthe license token
Returns
parsed representation of the license token.
Exceptions
tenduke::ee::licensing::InvalidLicenseTokenif the string is not a license token, e.g. there is no claim or several claims, which could be the licensed item name
tenduke::jwt::JWTParsingExceptionif the license token is not a proper JWT

Implements tenduke::ee::licensing::OfflineLicenseTokenParser.

◆ from() [2/2]

Lease tenduke::ee::licensing::impl::DefaultOfflineLicenseTokenParser::from ( const std::string & licenseToken,
const std::string & licensedItemName ) const
overridevirtual

Parses a single token of the given licensed item from given string.

Use this for licensing decisions. The license token carries the licensed item name only as a claim "<licensed item name>": true, and the backend signs also other tokens, e.g. ID-tokens, with the same key. The token is accepted only if it has the claim for the given licensed item, with the exact same name.

Parameters
licenseTokenthe license token
licensedItemNamename of the licensed item, which the license token must be for
Returns
parsed representation of the license token.
Exceptions
tenduke::ee::licensing::InvalidLicenseTokenif the string is not a license token of the licensed item
tenduke::jwt::JWTParsingExceptionif the license token is not a proper JWT

Implements tenduke::ee::licensing::OfflineLicenseTokenParser.


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