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

#include <LicenseTokenParser.h>

Detailed Description

Inheritance diagram for tenduke::ee::licensing::impl::LicenseTokenParser:
tenduke::ee::licensing::impl::KnownNameLicenseTokenParser tenduke::ee::licensing::impl::KnownNamesLicenseTokenParser

Public Member Functions

 LicenseTokenParser (const std::shared_ptr< const tenduke::jwt::JWTParser > &parseJwt)
 Constructs new instance.
virtual LeaseOrError from (const std::string &licenseToken) const
 Parses the token.

Protected Member Functions

virtual bool isLicensedItemName (const std::string &claimName, const std::string &claimValue) const
 Checks if given claim names the licensed item, e.g.

Constructor & Destructor Documentation

◆ LicenseTokenParser()

tenduke::ee::licensing::impl::LicenseTokenParser::LicenseTokenParser ( const std::shared_ptr< const tenduke::jwt::JWTParser > & parseJwt)
explicit

Constructs new instance.

Parameters
parseJwt-

Member Function Documentation

◆ from()

xdlici::LeaseOrError tenduke::ee::licensing::impl::LicenseTokenParser::from ( const std::string & licenseToken) const
virtual

Parses the token.

A token with error claims (<item>_errorCode etc.) is an error. Otherwise the token is a lease, if exactly one claim names the licensed item (see isLicensedItemName()) and the token has the lease id (jti). The backend signs also other tokens, e.g. ID-tokens and license release responses, with the same key, so a valid signature alone does not make a token a license token.

The numeric claims (exp, iat, ibb, ibe and rfr) can be integers or decimal numbers, a decimal number is truncated towards zero.

Parameters
licenseToken-
Returns
-
Exceptions
tenduke::ee::licensing::InvalidLicenseTokenif the token is neither an error nor a lease: no claim or several claims name the licensed item, or the lease id (jti) is missing. Also if a numeric claim is not a number or is out of the range of std::int64_t.
tenduke::jwt::JWTParsingExceptionif the license token is not a proper JWT

◆ isLicensedItemName()

bool tenduke::ee::licensing::impl::LicenseTokenParser::isLicensedItemName ( const std::string & claimName,
const std::string & claimValue ) const
protectedvirtual

Checks if given claim names the licensed item, e.g.

"item-1": true.

This implementation guesses: any claim with value true, which is not a well-known claim or an error claim, can be the licensed item name. Subclasses check against known licensed item names.

Parameters
claimName-
claimValue-
Returns
-

Reimplemented in KnownNameLicenseTokenParser, KnownNamesLicenseTokenParser, tenduke::ee::licensing::impl::KnownNameLicenseTokenParser, and tenduke::ee::licensing::impl::KnownNamesLicenseTokenParser.


The documentation for this class was generated from the following files:
  • client/enterprise/api/src/licensing/LicenseTokenParser.h
  • client/enterprise/api/src/licensing/LicenseTokenParser.cpp