From 8a08771014e3394d4d7b0864d603a1e4b91e2d81 Mon Sep 17 00:00:00 2001 From: Arnab Dutta <32794267+duttarnab@users.noreply.github.com> Date: Wed, 4 May 2022 14:59:29 +0530 Subject: [PATCH] feat: adding logs to debug license issues#1258 (#1281) --- .../adminui/service/license/LicenseDetailsService.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/jans-config-api/plugins/admin-ui-plugin/src/main/java/io/jans/ca/plugin/adminui/service/license/LicenseDetailsService.java b/jans-config-api/plugins/admin-ui-plugin/src/main/java/io/jans/ca/plugin/adminui/service/license/LicenseDetailsService.java index 4fd14f9649c..a6c4f62d80a 100644 --- a/jans-config-api/plugins/admin-ui-plugin/src/main/java/io/jans/ca/plugin/adminui/service/license/LicenseDetailsService.java +++ b/jans-config-api/plugins/admin-ui-plugin/src/main/java/io/jans/ca/plugin/adminui/service/license/LicenseDetailsService.java @@ -118,6 +118,7 @@ public LicenseApiResponse checkLicense() { return createLicenseResponse(true, 200, "Valid license present."); } } + log.error("license Credentials error response: {}", response.readEntity(String.class)); return createLicenseResponse(false, 500, "Active license not present."); } catch (Exception e) { @@ -169,6 +170,7 @@ public LicenseApiResponse activateLicense(LicenseRequest licenseRequest) { return createLicenseResponse(true, 200, "License have been activated."); } } + log.error("license Activation error response: {}", response.readEntity(String.class)); return createLicenseResponse(false, response.getStatus(), "License is not activated."); } catch (Exception e) { log.error(ErrorResponse.ACTIVATE_LICENSE_ERROR.getDescription(), e); @@ -197,7 +199,7 @@ public LicenseResponse getLicenseDetails() { Response response = request.get(); - log.info("license Credentials request status code: {}", response.getStatus()); + log.info("license details request status code: {}", response.getStatus()); if (response.getStatus() == 200) { JsonObject entity = response.readEntity(JsonObject.class); if (entity.getBoolean("license_active") && !entity.getBoolean("is_expired")) { @@ -217,7 +219,8 @@ public LicenseResponse getLicenseDetails() { return licenseResponse; } } - log.debug("Active license for admin-ui not present "); + log.error("license details error response: {}", response.readEntity(String.class)); + log.info("Active license for admin-ui not present "); licenseResponse.setLicenseEnabled(false); return licenseResponse; } catch (Exception e) { @@ -237,7 +240,8 @@ private MultivaluedMap createHeaderMap(LicenseConfiguration lice SecretKeySpec secret_key = new SecretKeySpec(licenseConfiguration.getSharedKey().getBytes(StandardCharsets.UTF_8), "HmacSHA256"); sha256_HMAC.init(secret_key); String signature = Base64.getEncoder().encodeToString(sha256_HMAC.doFinal(signing_string.getBytes(StandardCharsets.UTF_8))); - + log.debug("header signature for license api: {}", signature); + log.debug("header signature date for license api: {}", formattedDate); MultivaluedMap headers = new MultivaluedHashMap<>(); headers.putSingle("Content-Type", "application/json"); headers.putSingle("Date", formattedDate);