The Licensing module for Orchard Core CMS.
For Orchard Core module consumers
Manage all your module/feature license keys for module orchard core module that you purchased from orchard core module vendor.
For Module vendors
Build your module with license and let your customer use this module to manage their licenses for your module.
Features
- Manage License keys using Admin Panel
- Provides API to module vendor to implement license in their own module.
Add Surevelox.OrchardCore.Licensing
to your Orchard Core Web project
dotnet add package Surevelox.OrchardCore.Licensing
Include in Setup Recipe to enable the feature by default.
"steps": [
{
"name": "feature",
"enable": [
"Surevelox.OrchardCore.Licensing"
]
}
]
Implement CanHandle
and Handle
method, this method is called when user adds license key in Admin UI.
internal class LicenseHandler : ILicenseHandler
{
public bool CanHandle(string licenseKey)
{
return true;
}
public void Handle(LicenseValidationContext context,
out LicenseStatus? status, out string id, out DateTime? issuedUtc, out DateTime? expiresUtc,
out Dictionary<string, object> policies)
{
var key = context.LicenseKey;
// Add your own logic to see if the license key is belong to your module
// For example using microsoft standard licensing
LicenseManager.CurrentContext = context;
var license = LicenseManager.Validate(typeof(MyLicensedClass));
var canhandle = (license != null);
if (canhandle)
{
// get the license and polices from encrypted license file
status = LicenseStatus.Valid;
// Read from your license
issuedUtc = license.IssuedOn;
// Read from your license
expiredUtc = license.ExpiresOn;
// add your feature list
features = policies["features"];
id = "lic/my-product/" + license.Id;
}
else
{
// If key is unknown to this validator
id = null;
status = null;
createdUtc = null;
expiredUtc = null;
features = new string[] { };
}
}
}
services.AddOrchardCms()
.ConfigureServices( svc=>
{
svc.AddScoped<ILicenseHandler, LicenseHandler>();
});
Read the documentation here
See the open issues for a list of proposed features and known issues.
Like the the module? Support us by sponsoring Surevelox @ Github.