Configuring the Activation
The license is represented by the Activation
object, and there should be only a single instance of the Activation
class created for every seat in your app (usually only one, in case your application needs to hold multiple activation instances for more products, see "Multiple Activations Support" page). The state of the Activation
can be accessed through the Activation.State
property.
Configure Activation instance
The following command will create a new instance of the Activation
object in Uninitialized
state. Before configuring the activation, collect the Tenant ID and Licensing API URL from the Account -> API Credentials page in the UI.
There are the following configuration options available:
Tenant ID - ID of the tenant. Can be retrieved from the API Credentials page.
Product ID - the product for which we are implementing the licensing.
Remember that each "product" has its own unique ID. You will need to use different IDs for every product you release.
Seat ID - represents the machine, the user, or some other element which the license should be linked with. Because the seat ID usually depends on the information that is only available at runtime, it is configured as a function. We recommend using the Device Fingerprint functionality for the machine-specific seat ID.
Storage - holds the licensing data, which needs to be persisted on the machine, where your application is running. In the case of the desktop application, the usual choice is a file, and that's why we are providing a PlainTextActivationFileStorage in our SDK. Please note that the data in our PlainTextActivationFileStorage implementation are not encrypted, which allows the user to manipulate and export the licensing data.
Depending on your use case, we recommend using your own implementation of the
IActivationStorage
interface or the SecureActivationStorage that leverages the Zentitle2Core library secure storage implementation.Online Activation - allows the license activation when there is a network connection to the Licensing server. For the online activation, the following options need to be configured:
Licensing API URL - Licensing API base URL
HTTP Client Factory - HttpClient callback providing an HTTP Client for executing the Licensing API calls. The factory method enables the implementation of the proper HTTP Client's lifetime management, depending on your app's type. See the Guidelines for using HttpClient for more details.
Offline Activation - In rare cases when a machine lacks a network connection but the license needs to be activated anyway, offline activation can be configured in your application.
Logging - to have access to the SDK's logs, your logger factory implementing the ILoggerFactory interface can be plugged in.
Activation Operation Lock - the
Activation
class uses a locking mechanism that makes it thread-safe and prevents the parallel execution of multiple activation methods, which might lead to an inconsistent activation state. The default lock leverages SemaphoreSlim, but if you need a custom locking mechanism, you can provide your own implementation of theIActivationOperationLock
interface.State Transition Callback - if you want to "hook your own code" into the activation's state transition logic, you can define a callback, which is executed after the state has been changed.
Last updated