From 84b5cc6ee93bdf6f0ef7946402e197b90d6a5aaa Mon Sep 17 00:00:00 2001
From: Larbi Gharib <larbi.gharib@savoirfairelinux.com>
Date: Wed, 10 Feb 2021 22:07:32 +0100
Subject: [PATCH] Fix license check

Change-Id: I93360cb60fa19d1ef59c28f80fb3ab2ef8d6698b
---
 .../jami/jams/server/licensing/LicenseService.java   | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/jams-server/src/main/java/net/jami/jams/server/licensing/LicenseService.java b/jams-server/src/main/java/net/jami/jams/server/licensing/LicenseService.java
index 2dd3badd..772a2fd4 100644
--- a/jams-server/src/main/java/net/jami/jams/server/licensing/LicenseService.java
+++ b/jams-server/src/main/java/net/jami/jams/server/licensing/LicenseService.java
@@ -69,18 +69,16 @@ public class LicenseService {
             }
             try {
                 certificate.verify(caCertificate.getPublicKey());
+                //If all these checks have passed then:
+                Server.activated.set(true);
+                log.info("Server is activated with valid license: {}", Server.activated.get());
+                Server.appUpdater.setLicense(certificate,privateKey);
+                log.info("Successfully set license inside updater module!");
             }
             catch (Exception e) {
                 log.error("The license file you have provided could not be verified!");
                 Server.activated.set(false);
             }
-            //If all these checks have passed then:
-            Server.activated.set(true);
-            licenseInformation = X509Utils.extractSubscriptionTypeFromCertificate(certificate);
-            log.info("Server is activated with valid license: {}", Server.activated.get());
-            log.info("License type: {}",licenseInformation.getType());
-            Server.appUpdater.setLicense(certificate,privateKey);
-            log.info("Successfully set license inside updater module!");
         }
         catch (Exception e){
             log.error("A generic occurred while trying to load your license or your license could not be found");
-- 
GitLab