The core of license management is handled by a single, versatile validate
method. This method intelligently
adapts its behavior based on its invocation. When a license key is provided as an argument, the method performs
a dual function: it simultaneously validates the authenticity of the key and activates the license for the
current device. This streamlined approach ensures a seamless initial setup.
Following a successful license validation and activation, the client receives cryptographically encrypted and
digitally signed license data directly from the license server. This data, secured with the product's private
key on the server, is then automatically saved to the configured persistence location. Depending on your initial
setup, this could be either a designated file on the disk or an entry within the Windows Registry. Therefore,
when you call the validate method with a license key argument, it not only handles the validation and activation
but also seamlessly manages the saving of the activated license data, ensuring it's securely stored for future
use.
Implementing the validation of a given license is straightforward, requiring minimal code, as demonstrated
below.
// Validate the given license key
License.getInstance()
.validate("12345-12345-12345-12345") // validate the license key obtained from user
validate
method should be called
without any arguments. In this scenario, it will automatically load the previously saved license from its
persisted location (either disk or the Windows Registry) and perform the necessary validation checks. This
allows for effortless re-validation without requiring the user to re-enter their license key, providing a smooth
and efficient user experience after the initial setup.
// Validate previously activated license
License.getInstance()
.validate() // validate previously activated license
validate
method with the license key as
an argument. However, if the
floating license is to be validated against an offline Floating License Server, the validate
method should be
called without any arguments, but the server's address must be defined using the .server
method within the
builder. The Floating License Server address must be defined as a URL, with the /fls
path appended to the end.
// Validate the given floating license key
// on SaaS license server
License.getInstance()
.validate("12345-12345-12345-12345") // validate the license key obtained from user
// Validate the given floating license key
// on on-premises license server
License.getInstance().getBuilder()
.product("product-hash-code") // the only required argument
.server("https://license.company.com") // if using on-premises license server
.build();
License.getInstance()
.validate("12345-12345-12345-12345") // validate the license key obtained from user
http://server.company.com:16090/fls
.
The port number can be configured on the Floating License Server. The /fls
path is required; it can be added programmatically
to the given address.
// Validate/Get a license from Floating License Server
// installed on user's own internal network or servers.
// port 16090 is the default port number for floating license server
// "/fls" path must be added to the URL
License.getInstance().getBuilder()
.product("product-hash-code") // the only required argument
.server("https://license.company.com:16090/fls") // if using on-premises license server
.build();
License.getInstance()
.validate() // validate without any argument