Use Kentico licensing to license a user module

We developed the Kentico module, which we would like to license based on each site.

Has anyone else tried to use Kentico's built-in licensing for this purpose?

I think that there is a secure endpoint on our server that will check the domain / license on the Kentico website working with the module.

eg. If the domain / license does not exist on our servers, the module will not be launched for the site.

Is it possible?

+6
source share
1 answer

I think I may have figured this out.

In my module, I redefined the CheckLicense method as such:

public override bool CheckLicense(string domain, FeatureEnum feature, ObjectActionEnum action) { if (domain != null) domain = LicenseKeyInfoProvider.ParseDomainName(domain); int siteId = LicenseHelper.GetSiteIDbyDomain(domain); var licenseKey = LicenseKeyInfoProvider.GetLicenseKeyInfo(domain, FeatureEnum.Unknown); if (siteId > 0 && licenseKey != null) { // TODO: query external service with licenseKey.Domain for a valid license for this module return true; } return false; } 

And then I can use:

 ModuleManager.CheckModuleLicense("My.Module.Name", RequestContext.CurrentDomain, FeatureEnum.Unknown, ObjectActionEnum.Read) 

About features that ensure proper licensing of the module.

Overriding a method is a simplification; I implemented caching of external service requests to prevent a service request every time we want to check permissions.

I also send the license Key.Domain, because we are not interested in aliases, if the main domain is licensed, the module should work under any aliases.

What does this approach look like? Would really appreciate any feedback from those who did something similar, and what was chosen for the solution?

Thank you p.

+4
source

All Articles