Release notes for v4027
User based activations
Normally, node-locking (aka machine code locking) occurs on a per device basis. If your users change devices often, you can either use floating licensing or activate on a per user basis. "Adding a user" to a license can be accomplished with Key.Activate
and to verify a user using Key.GetKey
in combination with Helpers.VerifyPassword
. In practice, each user is an activation, where the password is stored as a machine code in secure form and friendly name is used for the username.
Note
This is method is different from user account authentication, where a new Cryptolens account is created for each user. Using user based activations does not create a new user, it only stores the user information locally in the license. The user has no way to change the password on their own by default.
var username = "testuser";
var password = Helpers.ComputePasswordHash("testpassword");
// Adding a user
var res = Key.Activate(AccessToken.AccessToken.Activate, new ActivateModel
{
Key = "KMZEW-SBRAE-VWCEK-CDLQE",
ProductId = 3349,
MachineCode = password,
FriendlyName = username
});
Assert.IsTrue(Helpers.IsSuccessful(res));
//verifying password
var res2 = Key.GetKey(AccessToken.AccessToken.GetKey, new KeyInfoModel
{
Key = "KMZEW-SBRAE-VWCEK-CDLQE",
ProductId = 3349
});
Assert.IsTrue(Helpers.VerifyPassword(res2.LicenseKey, "testuser", "testpassword"));
Assert.IsFalse(Helpers.VerifyPassword(res2.LicenseKey, "testuser", "testpassword2"));
Ambiguous method IsOnRightMachinePI
A previous updated caused Helpers.IsOnRightMachinePI to require all optional parameters (issue 56). This is now fixed so that the method can be called with only the LicenseKey object being provided.