LicenseSpring .Net SDK 7.32.1
Easily add Software Licensing to your application
Loading...
Searching...
No Matches
LicenseSpring.ILicenseManager Interface Reference

LicenseManager interface. More...

Inheritance diagram for LicenseSpring.ILicenseManager:
LicenseSpring.LicenseManager

Public Member Functions

ILicense ActivateAirGapLicense (string confirmationCode, string policyPath, string licenseKey, uint policyId)
 Verify Confirmation code and activate air gap license using given license policy or policies.
 
ILicense ActivateLicense (LicenseID licenseID)
 Activate license with given LicenseID.
 
ILicense ActivateLicense (LicenseID licenseID, DeviceVariable[] deviceVariables)
 Activate license with given LicenseID and device variables.
 
ILicense ActivateLicense (string data, string accountCode=null, bool useToken=false)
 Activate license using SSO.
 
ILicense ActivateLicenseOffline (string activationResponseFile=null)
 Activate provided offline activation file.
 
bool ChangePassword (LicenseID licenseID, string newPassword)
 Change user password, meaningful only for user-based products.
 
void ClearLocalStorage ()
 See BaseManager.ClearLocalStorage.
 
ILicense CurrentLicense ()
 See BaseManager.CurrentLicense.
 
string GetAirGapActivationCode (string initializationCode, string licenseKey)
 Get air gap Activation code.
 
string[] GetAllVersions (LicenseID licenseID)
 Get all available versions for given license.
 
ILicenseUser[] GetCustomerLicenseUsers (Customer customer)
 Get license users information by customer.
 
InstallationFile GetInstallationFile (LicenseID licenseID, IInstallationFileOptions options=null)
 Get InstallationFile information for given license.
 
string GetOfflineActivationFile (LicenseID licenseID, DeviceVariable[] deviceVariables, string activationRequestFile=null)
 Creates offline activation file request.
 
string GetOfflineActivationFile (LicenseID licenseID, string activationRequestFile=null)
 Creates offline activation file request.
 
ProductDetails GetProductDetails (bool includeCustomFields, bool includeLatestVersion, string env)
 Retrieve information about a product from LicenseSpring backend.
 
ProductDetails GetProductDetails (bool includeCustomFields=false, bool includeLatestVersion=false)
 Retrieve information about a product from LicenseSpring backend.
 
string GetSSOUrl (string accountCode=null, bool useToken=false)
 Get URL for Single sign-on license activation.
 
LicenseID GetTrialLicense (Customer user=null, string licensePolicy=null)
 Request trial license from LicenseSpring.
 
LicenseID GetTrialLicense (string email)
 Request trial license from LicenseSpring platform. Overloaded method.
 
UserLicensesData[] GetUserLicenses (string username, string password)
 Retrieves all licenses for the provided username and password and the product this LicenseManager is initialized for.
 
void Initialize (Configuration configuration, ILicenseStorage storage=null)
 See BaseManager.Initialize.
 
bool IsInitialized ()
 See BaseManager.IsInitialized.
 
bool IsOnline (bool throwExceptions=false)
 Helper method, it checks connection to the LicenseSpring backend.
 
string LicenseFilePath ()
 See BaseManager.LicenseFilePath.
 
ILicense RelinkLicense (DeviceIDAlgorithm deviceIdAlgorithm, string userPassword=null)
 This method helps upgrade to new device id algorithm. It deactivates current license with old device id and activate with new one. Internet connection is required.
 
ILicense ReloadLicense ()
 See BaseManager.ReloadLicense.
 

Properties

string DataLocation [get, set]
 See BaseManager.DataLocation.
 
string LicenseFileName [get, set]
 See BaseManager.LicenseFileName.
 

Detailed Description

LicenseManager interface.

Member Function Documentation

◆ ActivateAirGapLicense()

ILicense LicenseSpring.ILicenseManager.ActivateAirGapLicense ( string  confirmationCode,
string  policyPath,
string  licenseKey,
uint  policyId 
)

Verify Confirmation code and activate air gap license using given license policy or policies.

Available only in .NET Framework 4.7 or greater, .NET Standard, .NET 5.0 and later versions.

Parameters
confirmationCodeCode received from the air gap activation portal
policyPathPolicy file path or folder path which contains several policy files
licenseKeyLicense key
policyIdId of the license policy
Returns
License if activation succeeded
Exceptions
LicenseSpring.LicenseSpringExceptionIf feature not supported for current target Framework
System.InvalidOperationExceptionThrown when license manager is not initialized
System.IO.FileNotFoundExceptionThrown when provided file not found
LicenseSpring.SignatureMismatchExceptionIn case signature in activation file is not valid
LicenseSpring.ActivationFileExceptionIn case invalid activation file provided, check inner exception for more details.
LicenseSpring.AirGapActivationExceptionIn case confirmation code from the air gap activation portal is invalid.

◆ ActivateLicense() [1/3]

ILicense LicenseSpring.ILicenseManager.ActivateLicense ( LicenseID  licenseID)

Activate license with given LicenseID.

Parameters
licenseIDLicense ID: license key or email and password.
Returns
License if activation successful, throws exceptions in case of errors
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
LicenseSpring.ProductNotFoundExceptionIn case product does not exist on the platform
LicenseSpring.LicenseNotFoundExceptionIn case provided license was not found
LicenseSpring.LicenseActivationExceptionIn case something went wrong with license activation
LicenseSpring.LicenseDisabledExceptionThrown when license is disabled
LicenseSpring.LicenseExpiredExceptionThrown when license is expired
LicenseSpring.SignatureMismatchExceptionIn case signature returned by LicenseSpring backend is not valid or missing
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
System.Security.Authentication.InvalidCredentialExceptionIn case of wrong credential
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.CannotBeActivatedNowExceptionIf start_date field is set for the license and current date is behind start date
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ ActivateLicense() [2/3]

ILicense LicenseSpring.ILicenseManager.ActivateLicense ( LicenseID  licenseID,
DeviceVariable[]  deviceVariables 
)

Activate license with given LicenseID and device variables.

Parameters
licenseIDLicense ID: license key or email and password.
deviceVariablesAn array of device variables to be sent to the LicenseSpring platform during license activation.
Returns
License if activation successful, throws exceptions in case of errors
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
LicenseSpring.ProductNotFoundExceptionIn case product does not exist on the platform
LicenseSpring.LicenseNotFoundExceptionIn case provided license was not found
LicenseSpring.LicenseActivationExceptionIn case something went wrong with license activation
LicenseSpring.LicenseDisabledExceptionThrown when license is disabled
LicenseSpring.LicenseExpiredExceptionThrown when license is expired
LicenseSpring.SignatureMismatchExceptionIn case signature returned by LicenseSpring backend is not valid or missing
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
System.Security.Authentication.InvalidCredentialExceptionIn case of wrong credential
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.CannotBeActivatedNowExceptionIf start_date field is set for the license and current date is behind start date
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ ActivateLicense() [3/3]

ILicense LicenseSpring.ILicenseManager.ActivateLicense ( string  data,
string  accountCode = null,
bool  useToken = false 
)

Activate license using SSO.

You can omit accountCode param if you already set customer account code through the Configuration.

Parameters
dataid_token or code you get after user authorization with SSO
accountCodeCustomer account code
useTokenWhether to use id_token instead of code for activation
Returns
License if activation succeeded, throws exceptions in case of errors
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized or token is empty
LicenseSpring.ProductNotFoundExceptionIn case product does not exist on the platform
LicenseSpring.LicenseNotFoundExceptionIn case provided license was not found
LicenseSpring.LicenseActivationExceptionIn case something went wrong with license activation
LicenseSpring.LicenseDisabledExceptionThrown when license is disabled
LicenseSpring.LicenseExpiredExceptionThrown when license is expired
LicenseSpring.LicenseSpringExceptionIn case customer account code is not set in Configuration and in the method parameter.
LicenseSpring.SignatureMismatchExceptionIn case signature returned by LicenseSpring backend is not valid or missing
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
System.Security.Authentication.InvalidCredentialExceptionIn case of wrong credential
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.CannotBeActivatedNowExceptionIf start_date field is set for the license and current date is behind start date
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ ActivateLicenseOffline()

ILicense LicenseSpring.ILicenseManager.ActivateLicenseOffline ( string  activationResponseFile = null)

Activate provided offline activation file.

Parameters
activationResponseFileActivation response file path, null means use default path (Desktop)
Returns
License if activation succeeded
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
System.IO.FileNotFoundExceptionThrown when provided file not found
LicenseSpring.SignatureMismatchExceptionIn case signature in activation file is not valid
LicenseSpring.ActivationFileExceptionIn case invalid activation file provided, check inner exception for more details.

Implemented in LicenseSpring.LicenseManager.

◆ ChangePassword()

bool LicenseSpring.ILicenseManager.ChangePassword ( LicenseID  licenseID,
string  newPassword 
)

Change user password, meaningful only for user-based products.

Parameters
licenseIDLicenseID: email and password
newPasswordNew password
Returns
True if successfully changed and false otherwise.
Exceptions
System.Security.Authentication.InvalidCredentialExceptionIn case of wrong password
LicenseSpring.PasswordChangeNotAllowedExceptionIf changing password is forbidden
LicenseSpring.MissingParametersExceptionIf password or newPassword is empty
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ GetAirGapActivationCode()

string LicenseSpring.ILicenseManager.GetAirGapActivationCode ( string  initializationCode,
string  licenseKey 
)

Get air gap Activation code.

Available only in .NET Framework 4.7 or greater, .NET Standard, .NET 5.0 and later versions.

Parameters
initializationCodeCode received from the air gap activation portal.
licenseKeyLicense key of air gap license.
Returns
Air gap Activation code.
Exceptions
LicenseSpring.LicenseSpringExceptionIf feature not supported for current target Framework

Implemented in LicenseSpring.LicenseManager.

◆ GetAllVersions()

string[] LicenseSpring.ILicenseManager.GetAllVersions ( LicenseID  licenseID)

Get all available versions for given license.

Parameters
licenseIDLicense id: license key or user id.
Returns
An array of versions available for the license
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
LicenseSpring.ProductNotFoundExceptionIn case product does not exist on the platform
LicenseSpring.LicenseNotFoundExceptionIn case provided license was not found
LicenseSpring.LicenseStateExceptionIn case provided license is not active
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ GetCustomerLicenseUsers()

ILicenseUser[] LicenseSpring.ILicenseManager.GetCustomerLicenseUsers ( Customer  customer)

Get license users information by customer.

Please note that email is required field in Customer information

Parameters
customerCustomer information
Returns
Array of license users
Exceptions
LicenseSpring.InvalidAuthMethodExceptionThrown when this method is called for key-based product.
LicenseSpring.CustomerNotFoundExceptionIn case customer does not exist.
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring server error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ GetInstallationFile()

InstallationFile LicenseSpring.ILicenseManager.GetInstallationFile ( LicenseID  licenseID,
IInstallationFileOptions  options = null 
)

Get InstallationFile information for given license.

Parameters
licenseIDLicense id: license key or user id.
optionsProviding InstallationFileOptions you can filter install files by channel or environment, you can also specify needed version.

This param is optional, if not provided then last available version assumed from default channel.

Returns
InstallationFile object
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
LicenseSpring.ProductNotFoundExceptionIn case product does not exist on the platform
LicenseSpring.LicenseNotFoundExceptionIn case provided license was not found
LicenseSpring.LicenseStateExceptionIn case provided license is not active
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ GetOfflineActivationFile() [1/2]

string LicenseSpring.ILicenseManager.GetOfflineActivationFile ( LicenseID  licenseID,
DeviceVariable[]  deviceVariables,
string  activationRequestFile = null 
)

Creates offline activation file request.

Parameters
licenseIDLicense ID, license key or email and password.
deviceVariablesAn array of device variables to be sent to the LicenseSpring platform during license activation.
activationRequestFileActivation request file path, null means use default path (Desktop)
Returns
Path to offline activation file request
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized

Implemented in LicenseSpring.LicenseManager.

◆ GetOfflineActivationFile() [2/2]

string LicenseSpring.ILicenseManager.GetOfflineActivationFile ( LicenseID  licenseID,
string  activationRequestFile = null 
)

Creates offline activation file request.

Parameters
licenseIDLicense ID, license key or email and password.
activationRequestFileActivation request file path, null means use default path (Desktop)
Returns
Path to offline activation file request
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized

Implemented in LicenseSpring.LicenseManager.

◆ GetProductDetails() [1/2]

ProductDetails LicenseSpring.ILicenseManager.GetProductDetails ( bool  includeCustomFields,
bool  includeLatestVersion,
string  env 
)

Retrieve information about a product from LicenseSpring backend.

In offline mode data will be retrieved from license file if present.

Parameters
includeCustomFieldsOptional parameter, if true return object contains custom fields data.
includeLatestVersionOptional parameter, if true return object contains additional information about the latest version. Default false.
envOptional parameter, filters products by environment string (as defined by installation file "environment").
Returns
Product details
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
LicenseSpring.ProductNotFoundExceptionIn case product does not exist on the server
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.SignatureMismatchExceptionIn case signature returned by LicenseSpring backend is not valid or missing
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ GetProductDetails() [2/2]

ProductDetails LicenseSpring.ILicenseManager.GetProductDetails ( bool  includeCustomFields = false,
bool  includeLatestVersion = false 
)

Retrieve information about a product from LicenseSpring backend.

In offline mode data will be retrieved from license file if present.

Parameters
includeCustomFieldsOptional parameter, if true return object contains custom fields data.
includeLatestVersionOptional parameter, if true return object contains additional information about the latest version. Default false.
Returns
Product details
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
LicenseSpring.ProductNotFoundExceptionIn case product does not exist on the server
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.SignatureMismatchExceptionIn case signature returned by LicenseSpring backend is not valid or missing
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ GetSSOUrl()

string LicenseSpring.ILicenseManager.GetSSOUrl ( string  accountCode = null,
bool  useToken = false 
)

Get URL for Single sign-on license activation.

You can omit accountCode param if you already set customer account code through the Configuration.

Parameters
accountCodeCustomer account code
useTokenBoolean value indicating whether this method should create the redirect_uri with id_token instead of code.
Returns
URL for Single sign-on
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
LicenseSpring.LicenseSpringExceptionIn case customer account code is not set in Configuration and param
LicenseSpring.ProductNotFoundExceptionIn case product does not exist on the server
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.SignatureMismatchExceptionIn case signature returned by LicenseSpring backend is not valid or missing
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ GetTrialLicense() [1/2]

LicenseID LicenseSpring.ILicenseManager.GetTrialLicense ( Customer  user = null,
string  licensePolicy = null 
)

Request trial license from LicenseSpring.

If you provide user information please note that user's email is required field

Parameters
userUser information. Optional param for key-based products, but required for user-based products.
licensePolicyLicense policy code. Optional param, if omited the default license policy for the product will be used.
Returns
Trial LicenseID
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
LicenseSpring.ProductNotFoundExceptionIn case product does not exist on the platform
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ GetTrialLicense() [2/2]

LicenseID LicenseSpring.ILicenseManager.GetTrialLicense ( string  email)

Request trial license from LicenseSpring platform. Overloaded method.

Parameters
emailUser's email
Returns
Trial LicenseID
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
LicenseSpring.ProductNotFoundExceptionIn case product does not exist on the platform
LicenseSpring.LicenseServerExceptionIn case of internal LicenseSpring backend error
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.UnknownLicenseSpringExceptionIn rare case if something went wrong.

Implemented in LicenseSpring.LicenseManager.

◆ GetUserLicenses()

UserLicensesData[] LicenseSpring.ILicenseManager.GetUserLicenses ( string  username,
string  password 
)

Retrieves all licenses for the provided username and password and the product this LicenseManager is initialized for.

Parameters
usernameUsername of the user for whom the licenses will be retrieved.
passwordPassword of the user for whom the licenses will be retrieved.
Returns
Array of licenses and user information for each license. Returns an empty array if username or passoword is not provided.

Implemented in LicenseSpring.LicenseManager.

◆ IsOnline()

bool LicenseSpring.ILicenseManager.IsOnline ( bool  throwExceptions = false)

Helper method, it checks connection to the LicenseSpring backend.

Parameters
throwExceptionsBoolean value indicating whether this method should throw exceptions, by default it's false.
Returns
True if SDK is able to connect to the LicenseSpring platform and false otherwise.
Exceptions
System.InvalidOperationExceptionThrown when license manager is not initialized
LicenseSpring.NetworkExceptionIn case of network errors, e.g. no Internet connection or operation timed out.

Implemented in LicenseSpring.LicenseManager.

◆ RelinkLicense()

ILicense LicenseSpring.ILicenseManager.RelinkLicense ( DeviceIDAlgorithm  deviceIdAlgorithm,
string  userPassword = null 
)

This method helps upgrade to new device id algorithm. It deactivates current license with old device id and activate with new one. Internet connection is required.

Local license is required to call this method. May throw exceptions the same as ActivateLicense and License.Deactivate methods.

Parameters
deviceIdAlgorithmDevice id algorithm generation you would like to upgrade to
userPasswordOptional param, user password, meaningful only for user-based licenses
Returns
License if reactivation succeeded
Exceptions
System.InvalidOperationExceptionThrown when there is no local license exists
LicenseSpring.ProductMismatchExceptionIf license product code does not correspond to configuration product code
LicenseSpring.OAuthExceptionIn case of invalid or expired OAuth credentials.
LicenseSpring.DeviceNotLicensedExceptionIf reactivation is not possible (e.g. license copied from other device)

Implemented in LicenseSpring.LicenseManager.


The documentation for this interface was generated from the following file: