|
10Duke Scale C++ SDK
|
For an overview of authenticating requests using a license key, see the following sections in the 10Duke Scale documentation:
You can use a license key to authenticate a device or user. The license key can be embedded in a device or prompted from the user. The following licensing operations can be executed with a license key without a login:
tenduke::se::licensing::LicensingClient::checkoutLicensesWithKey(const std::string &) const and tenduke::se::licensing::LicensingClient::checkoutLicensesWithKey(const std::string &,const tenduke::se::licensing::LicenseCheckoutParameters &) consttenduke::se::licensing::LicensingClient::heartbeatLicenses() const and tenduke::se::licensing::LicensingClient::heartbeatLicenses(const tenduke::se::licensing::LicenseHeartbeatParameters &) consttenduke::se::licensing::LicensingClient::releaseLicenses() const and tenduke::se::licensing::LicensingClient::releaseLicenses(const tenduke::se::licensing::LicenseReleaseParameters &) consttenduke::se::licensing::LicensingClient::describeLicenseKey(const std::string &) const and tenduke::se::licensing::LicensingClient::describeLicenseKey(const std::string &,const tenduke::se::Paging &,bool) constNote that you don't need to provide a license key to heartbeat or release. The client remembers that the lease was checked out with a license key and automatically fills in the license key.
If you only need the above operations, you can use tenduke::se::TendukeClient: This service works with license keys only. To create an instance of the service, use the factory function tenduke::se::createTendukeClientForLicenseKeyUsage(const std::string &,const tenduke::se::BackendConfiguration &,const tenduke::se::ClientProperties &,const std::string &initialStateAsJson,const ::tenduke::ServiceConfiguration &).
See also client concepts.
The following examples demonstrate how to perform typical operations using a license key.
Create the client:
Check out licenses:
Send a heartbeat for a lease (note that you don't need to provide the license key)
NOTE: A heartbeat generates new IDs for the leases.
To release the licenses after a heartbeat (note that you don't need to provide the license key):
The licensing client has a memory cache, which holds leases of checked-out licenses and automatically manages the leases after a heartbeat or release request. To list all leases currently in cache:
The client allows you to only operate (heartbeat or release) on leases that are present in the cache. If you want to release all checked-out licenses, you can do:
For all available services, see tenduke::se::TendukeClient.