Package io.mosip.kernel.lkeymanager.util
Class LicenseKeyManagerUtil
- java.lang.Object
-
- io.mosip.kernel.lkeymanager.util.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 Summary
Constructors Constructor Description LicenseKeyManagerUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareValidPermissions(List<String> inputPermissions)This method validates whether the input permissions are from the master list or not.StringconcatPermissionsIntoASingleRow(List<String> permissionsList)This method adds all the permissions into a single row separated by comma.StringgenerateLicense()Method that generates a random license key of specified length.LocalDateTimegetCurrentTimeInUTCTimeZone()Method that returns the current date-time in UTC time zone.voidvalidateRequestParameters(String tspID, String licenseKey, List<String> permissions)Method to validate TSP ID, License Key, and the list of permissions.voidvalidateTSP(String tspID)Method to validate TSP ID.voidvalidateTSPAndLicenseKey(String tspID, String licenseKey)Method to validate TSP ID and License Key.
-
-
-
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.
-
-