lundi 17 septembre 2018

How to separate licensing code into Layers? One for validation and other for License Creation

I am working on a licensing architecture for my internal projects. (No space for the additional cost of Gemalto). My License manager will have two responsibilities,

  1. Read from file and Validate the License (to be used in the applications that I create)
  2. Generate a license file with the information supplied (will stay with me as an internal tool)

Now Part 1 and 2 are going to depend on the same encryption-decryption and serialization-deserialization logic.

public interface ILicenseManager
{
    License ValidateAndGetLicense();
    void CreateLicense(License license);
}

I need here to structure my license manager class in such a way that only code needed for Part 1 (i.e. decryption and reading) gets shipped to the customer. Another part always remains with me.

The aim here is not to repeat code. Depend on the same logic. Is there any standard way of doing it or any design principal that handles this situation.

I have considered using ISP (interface segregation principal) and Proxy pattern. But still, both will need the whole assembly to be shipped. Another option is to separate the logic and write them in separate assemblies.

Aucun commentaire:

Enregistrer un commentaire