Class LicenseDetailsService
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class io.jans.ca.plugin.adminui.service.BaseService
httpService, mapper, TLS_ALLOWED_CIPHER_SUITES, TLS_ENABLED_PROTOCOLS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactivateLicense(LicenseRequest licenseRequest) Activate a license with the configured License API and persist updated license details.Verify that the stored license configuration is present, current, and not expired.Deletes the license-related configuration in both the persistent and in-memory Admin UI configuration.Generates a trial license via the configured License API and saves the returned license key to persistence and the in-memory AUI configuration.This function is used to get the license details of the admin-uipostSSA(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 configurationRetrieve license details from the configured License API.Validates the license configuration by checking for the presence of required parameters.Methods inherited from class io.jans.ca.plugin.adminui.service.BaseService
executeDCR, getToken, getToken, introspectToken
-
Field Details
-
LICENSE_KEY
- See Also:
-
HARDWARE_ID
- See Also:
-
BEARER
- See Also:
-
MESSAGE
- See Also:
-
CODE
- See Also:
-
LICENSE_ISACTIVE_ERROR_RESPONSE
- See Also:
-
LICENSE_RETRIEVE_ERROR_RESPONSE
- See Also:
-
LICENSE_ACTIVATE_ERROR_RESPONSE
- See Also:
-
LICENSE_APIS_404
- See Also:
-
LICENSE_APIS_503
- See Also:
-
TRIAL_GENERATE_ERROR_RESPONSE
- See Also:
-
HTTP_RESPONSE_IS_NULL
- See Also:
-
-
Constructor Details
-
LicenseDetailsService
public LicenseDetailsService()
-
-
Method Details
-
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.
-
deleteLicenseConfiguration
Deletes the license-related configuration in both the persistent and in-memory Admin UI configuration. -
checkLicense
Verify that the stored license configuration is present, current, and not expired.If the configuration is missing, incomplete, expired, or due for refresh, the method initiates synchronization with the license service and returns the corresponding error response. When the license is valid and up-to-date, the response contains custom attributes (including the `mau_threshold`) describing license limits.
- Returns:
- a `GenericResponse` with `true` and HTTP 200 containing license custom attributes (including `mau_threshold`) when the license is valid; otherwise `false` with an appropriate HTTP error code and diagnostic message.
-
retrieveLicense
Retrieve license details from the configured License API.Validates that the local license configuration contains a hardware ID and scan API hostname, obtains an access token, and queries the remote retrieve endpoint. On success returns a response containing `licenseKey` and `mauThreshold` in the response payload.
- Returns:
- GenericResponse containing `licenseKey` and `mauThreshold` on success (HTTP 200); otherwise a GenericResponse with an appropriate error code and message (for example, 402 for payment required, 404/503 when the license API is inaccessible, or 500 for other server-side errors).
-
activateLicense
Activate a license with the configured License API and persist updated license details.- Parameters:
licenseRequest- request containing the license key to activate- Returns:
- a GenericResponse indicating success or failure; on success (HTTP 200) the response contains a message and the license's updated custom_fields, on failure the response contains an error message and an appropriate HTTP status code
-
generateTrialLicense
Generates a trial license via the configured License API and saves the returned license key to persistence and the in-memory AUI configuration.On success returns a response containing a JSON object with the `license-key`. On failure returns a response with an appropriate error code and message reflecting token generation failures, HTTP errors from the License API, missing fields in the API response, or internal server errors.
- Returns:
- GenericResponse with status `true` and a JSON payload containing `license-key` on success; `false` with an error code and message otherwise.
-
getLicenseDetails
This function is used to get the license details of the admin-ui- Returns:
- A LicenseResponse object
-
postSSA
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.
-