SDKs
...
Floating Server Usage
Floating Server V2
4 min
licensespring sdks support both floating server v1 and v2 here we demonstrate how to retrieve and register licenses on floating server v2 in some sdks you can reuse the same interface for handling licenses on floating server v1, with an additional function used for fetching all floating licenses tied to a single product each license has its own 64 bit integer license id , called the server side license id in licensespring sdks certificate and signature verification each floating server instance has its own private key used for signing response payloads, and you should have received a certificate chain tied to your instance to verify the certificate and to verify signatures returned by the floating server, you must enter the whole certificate chain into the sdk you can do it by specifying an absolute or relative path to the chain pem file, or input the whole chain as a string constant c++ #include \<licensespring/extendedoptions h> options setcertificatechainfromfile("chain pem"); // or options setcertificatechain(r"( cert )");options setcertificatechainfromfile("chain pem"); // or options certificatechain = "( cert )";# api client configuration from licensespring floating server import floatingapiclient api client = floatingapiclient(api protocol="http",api domail="localhost 8080",certificate chain path="path to pem file/chain pem") \# floating manager configuration from licensespring licensefile config import configuration from licensespring licensefile floating manager import floatingmanager conf = configuration(product="your product key",api key="your api key", shared key="your shared key",file key=key,file iv=iv, is guard file enabled=true,certificate chain path="path to pem file/chain pem") fs manager = floatingmanager(conf=conf) if you're getting a license signature is not valid error or a similar verification error, you're missing the floating server certificate chain, or set the wrong one authentication and license registration registering and using a license requires users to be logged in to an account created on the floating server the sdk manages token lifetime automatically \#include \<licensespring/floatingclient h> \#include \<licensespring/extendedoptions h> // licensespring extendedoptions options; options setcertificatechainfromfile("chain pem"); // or options setcertificatechain(r"( cert )"); // and other options auto config = licensespring configuration create(/ /); auto fc = licensespring floatingclient create(config); // authenticate the user if it is required // you should first create the user on the floating server itself fc >authenticateuser("user", "pass"); // floatingclient getalllicenses returns one licenseid for each license tied to the configured product code std vector\<licensespring licenseid> licenseids = fc >getalllicenses(); // check if at least one license exists if (licenseids empty()) return 1; for (const auto \&licenseid licenseids) { std cout << "server side license id " << licenseid serverid(); // licenseid key() will return the license key of the license } // register the first license, same as on floating server v1 auto licenseid = licenseid front(); std string username = "john"; auto license = fc >registerlicense(username, licenseid); var floatingclient = new floatingclient(); floatingclient initialize( lsconfig ); var licenseids = floatingclient getalllicenses(); // check if at least one license exists if (!licenseids any()) return; foreach (licenseid licenseid in licenseids) { console writeline("server side license id " + licenseid serverid); // licenseid key and licenseid user will return empty strings } // register the first license, same as on floating server v1 var username = "john"; var licenseid = licenseids\[0]; license = floatingclient register(username, licenseid); manually setting up a license id with the license key, or a username and password combination does not work in floating server v2


