Class LicenseDetailsService
- java.lang.Object
- 
- io.jans.ca.plugin.adminui.service.BaseService
- 
- io.jans.ca.plugin.adminui.service.license.LicenseDetailsService
 
 
- 
 @Singleton public class LicenseDetailsService extends BaseService 
- 
- 
Field SummaryFields Modifier and Type Field Description static StringAPPLICATION_JSONstatic StringAUTHORIZATIONstatic StringBEARERstatic StringCODEstatic StringCONTENT_TYPEstatic StringHARDWARE_IDstatic StringLICENSE_ACTIVATE_ERROR_RESPONSEstatic StringLICENSE_APIS_404static StringLICENSE_APIS_503static StringLICENSE_ISACTIVE_ERROR_RESPONSEstatic StringLICENSE_KEYstatic StringLICENSE_RETRIEVE_ERROR_RESPONSEstatic StringMESSAGEstatic StringTRIAL_GENERATE_ERROR_RESPONSE
 - 
Constructor SummaryConstructors Constructor Description LicenseDetailsService()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description GenericResponseactivateLicense(LicenseRequest licenseRequest)The function checks if the license is already active, if not, it creates a header map, creates a body map, and sends a POST request to the license serverGenericResponsecheckLicense()Checks if the license details are valid and up-to-date.GenericResponsedeleteLicenseConfiguration()Deletes the license-related configuration in both the persistent and in-memory Admin UI configuration.GenericResponsegenerateTrialLicense()This function generates a trial license by sending a request to a specified URL and saving the license key in the configuration.LicenseResponsegetLicenseDetails()This function is used to get the license details of the admin-uiGenericResponsepostSSA(SSARequest ssaRequest)The function takes an SSA string as input, calls the DCR API to get the scan hostname and OIDC client settings, and saves the SSA string and the scan hostname and OIDC client settings in the Admin UI configurationGenericResponseretrieveLicense()The function `retrieveLicense()` retrieves a license using the provided configuration and returns a generic response.GenericResponsevalidateLicenseConfiguration()Validates the license configuration by checking for the presence of required parameters.- 
Methods inherited from class io.jans.ca.plugin.adminui.service.BaseServiceexecuteDCR, getClaims, getToken, getToken, introspectToken
 
- 
 
- 
- 
- 
Field Detail- 
AUTHORIZATIONpublic static final String AUTHORIZATION - See Also:
- Constant Field Values
 
 - 
CONTENT_TYPEpublic static final String CONTENT_TYPE - See Also:
- Constant Field Values
 
 - 
APPLICATION_JSONpublic static final String APPLICATION_JSON - See Also:
- Constant Field Values
 
 - 
LICENSE_KEYpublic static final String LICENSE_KEY - See Also:
- Constant Field Values
 
 - 
HARDWARE_IDpublic static final String HARDWARE_ID - See Also:
- Constant Field Values
 
 - 
BEARERpublic static final String BEARER - See Also:
- Constant Field Values
 
 - 
MESSAGEpublic static final String MESSAGE - See Also:
- Constant Field Values
 
 - 
CODEpublic static final String CODE - See Also:
- Constant Field Values
 
 - 
LICENSE_ISACTIVE_ERROR_RESPONSEpublic static final String LICENSE_ISACTIVE_ERROR_RESPONSE - See Also:
- Constant Field Values
 
 - 
LICENSE_RETRIEVE_ERROR_RESPONSEpublic static final String LICENSE_RETRIEVE_ERROR_RESPONSE - See Also:
- Constant Field Values
 
 - 
LICENSE_ACTIVATE_ERROR_RESPONSEpublic static final String LICENSE_ACTIVATE_ERROR_RESPONSE - See Also:
- Constant Field Values
 
 - 
LICENSE_APIS_404public static final String LICENSE_APIS_404 - See Also:
- Constant Field Values
 
 - 
LICENSE_APIS_503public static final String LICENSE_APIS_503 - See Also:
- Constant Field Values
 
 - 
TRIAL_GENERATE_ERROR_RESPONSEpublic static final String TRIAL_GENERATE_ERROR_RESPONSE - See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
validateLicenseConfigurationpublic GenericResponse validateLicenseConfiguration() Validates the license configuration by checking for the presence of required parameters. This method retrieves the license configuration from the persistence layer and checks the following: 1. The existence of the license hardware key. 2. The presence and validity of OIDC client details (OP host, client ID, client secret). 3. The presence of the SSA (Software Statement Assertion). 4. The existence of the license key. 5. The presence of the scan license API hostname. 6. The last updated date of the license details. If missing, it triggers synchronization of OIDC client details. 7. The time elapsed since the last license details update, comparing it with the configured synchronization interval. If the interval has passed, it initiates synchronization of OIDC client details.- Returns:
- A GenericResponse object indicating the validity of the license configuration. - Returns a successful response (true, 200) if all required parameters are present and valid. - Returns an error response (false, various error codes) if any required parameter is missing or invalid.
 
 - 
deleteLicenseConfigurationpublic GenericResponse deleteLicenseConfiguration() throws Exception Deletes the license-related configuration in both the persistent and in-memory Admin UI configuration.- Throws:
- Exception
 
 - 
checkLicensepublic GenericResponse checkLicense() Checks if the license details are valid and up-to-date. This method retrieves the license configuration from the persistence layer and performs several checks: 1. It verifies the presence of essential license configuration parameters like hardware key, license key, and scan API hostname. 2. It checks if the license validity and last update dates are available. If not, it triggers a synchronization with Agama Lab. 3. It calculates the time elapsed since the last license details update and compares it with the configured synchronization interval. If the interval has passed, it initiates a synchronization. 4. It determines if the license has expired by comparing the current date with the license validity date. If expired, it triggers a synchronization. 5. If all checks pass, it constructs a JSON response containing custom attributes (specifically, the MAU threshold) and returns a success response.- Returns:
- A GenericResponse object indicating the validity of the license and containing relevant license details. - Returns a successful response (true, 200) with license details if the license is valid and up-to-date. - Returns an error response (false, various error codes) if any configuration is missing, the license is invalid, or an exception occurs during the process.
 
 - 
retrieveLicensepublic GenericResponse retrieveLicense() The function `retrieveLicense()` retrieves a license using the provided configuration and returns a generic response.- Returns:
- The method `retrieveLicense()` returns a `GenericResponse` object.
 
 - 
activateLicensepublic GenericResponse activateLicense(LicenseRequest licenseRequest) The function checks if the license is already active, if not, it creates a header map, creates a body map, and sends a POST request to the license server- Parameters:
- licenseRequest- The license key that you received from the license server.
- Returns:
- A LicenseApiResponse object.
 
 - 
generateTrialLicensepublic GenericResponse generateTrialLicense() This function generates a trial license by sending a request to a specified URL and saving the license key in the configuration.- Returns:
- The method is returning a LicenseApiResponse object.
 
 - 
getLicenseDetailspublic LicenseResponse getLicenseDetails() This function is used to get the license details of the admin-ui- Returns:
- A LicenseResponse object
 
 - 
postSSApublic GenericResponse postSSA(SSARequest ssaRequest) The function takes an SSA string as input, calls the DCR API to get the scan hostname and OIDC client settings, and saves the SSA string and the scan hostname and OIDC client settings in the Admin UI configuration- Parameters:
- ssaRequest- The SSA request object.
- Returns:
- A LicenseApiResponse object.
 
 
- 
 
-