Class LicenseKeyManagerUtil


  • @RefreshScope
    @Component
    public class LicenseKeyManagerUtil
    extends Object
    This class provides several utility methods to be used in license key manager service.
    Since:
    1.0.0
    Author:
    Sagar Mahapatra
    • Constructor Detail

      • LicenseKeyManagerUtil

        public LicenseKeyManagerUtil()
    • Method Detail

      • concatPermissionsIntoASingleRow

        public String concatPermissionsIntoASingleRow​(List<String> permissionsList)
        This method adds all the permissions into a single row separated by comma.
        Parameters:
        permissionsList - the list of permissions.
        Returns:
        the resultant string.
      • areValidPermissions

        public boolean areValidPermissions​(List<String> inputPermissions)
        This method validates whether the input permissions are from the master list or not.
        Parameters:
        inputPermissions - the list of input permissions.
        Returns:
        true if all the input permissions are valid.
      • getCurrentTimeInUTCTimeZone

        public LocalDateTime getCurrentTimeInUTCTimeZone()
        Method that returns the current date-time in UTC time zone.
        Returns:
        the local date time as specified.
      • generateLicense

        public String generateLicense()
        Method that generates a random license key of specified length.
        Returns:
        the generated license key.
      • validateTSP

        public void validateTSP​(String tspID)
        Method to validate TSP ID.
        Parameters:
        tspID - the TSP ID to be validated.
      • validateTSPAndLicenseKey

        public void validateTSPAndLicenseKey​(String tspID,
                                             String licenseKey)
        Method to validate TSP ID and License Key.
        Parameters:
        tspID - the TSP ID to be validated.
        licenseKey - the license key to be validated.
      • validateRequestParameters

        public void validateRequestParameters​(String tspID,
                                              String licenseKey,
                                              List<String> permissions)
        Method to validate TSP ID, License Key, and the list of permissions.
        Parameters:
        tspID - the TSP ID.
        licenseKey - the license Key.
        permissions - the list of permissions.