Skip to content

Commit

Permalink
feat: adding logs to debug license issues#1258 (#1281)
Browse files Browse the repository at this point in the history
  • Loading branch information
duttarnab authored May 4, 2022
1 parent 0a6a3d6 commit 8a08771
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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")) {
Expand All @@ -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) {
Expand All @@ -237,7 +240,8 @@ private MultivaluedMap<String, Object> 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<String, Object> headers = new MultivaluedHashMap<>();
headers.putSingle("Content-Type", "application/json");
headers.putSingle("Date", formattedDate);
Expand Down

0 comments on commit 8a08771

Please sign in to comment.