From 09bb2b3b9300e332f8b743481fbb412df8cd2a89 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Wed, 22 Oct 2014 16:07:15 +0000
Subject: [PATCH] #2021 feature - Added changes on client to use PackID and other changes related with license file fields

---
 src/main/java/net/curisit/securis/LicenseValidator.java |   87 ++++++++++++++++++++++---------------------
 1 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/src/main/java/net/curisit/securis/LicenseValidator.java b/src/main/java/net/curisit/securis/LicenseValidator.java
index a8d9d7b..ad4bd29 100644
--- a/src/main/java/net/curisit/securis/LicenseValidator.java
+++ b/src/main/java/net/curisit/securis/LicenseValidator.java
@@ -14,55 +14,56 @@
 
 public class LicenseValidator {
 
-	private static final Logger LOG = LogManager.getLogger(LicenseValidator.class);
+    private static final Logger LOG = LogManager.getLogger(LicenseValidator.class);
 
-	private static LicenseValidator singleton = new LicenseValidator();
-	protected static byte[] LOGO_SECRET;
+    private static LicenseValidator singleton = new LicenseValidator();
+    protected static byte[] LOGO_SECRET;
 
-	static {
-		try {
-			LOGO_SECRET = "Logo ipsum s3cr3t test áíóú".getBytes("utf-8");
-		} catch (UnsupportedEncodingException e) {
-			LOG.error("Unexpected error getting LOGO secret", e);
-		}
-	}
+    static {
+        try {
+            LOGO_SECRET = "Logo ipsum s3cr3t test áíóú".getBytes("utf-8");
+        } catch (UnsupportedEncodingException e) {
+            LOG.error("Unexpected error getting LOGO secret", e);
+        }
+    }
 
-	private LicenseValidator() {
-	}
+    private LicenseValidator() {
+    }
 
-	public static LicenseValidator getInstance() {
-		return singleton;
-	}
+    public static LicenseValidator getInstance() {
+        return singleton;
+    }
 
-	/**
-	 * @return CRC string for customer logo
-	 */
-	public String getCrcLogo() {
-		InputStream is = getClass().getClassLoader().getResourceAsStream("images/logo_customer.png");
-		try {
-			String shaLogo = LicUtils.sha256(IOUtils.toByteArray(is), LOGO_SECRET);
-			return shaLogo;
-		} catch (IOException e) {
-			LOG.warn("Customer logo was not found in images/logo_customer.png");
-			return null;
-		}
-	}
+    /**
+     * @return CRC string for customer logo
+     */
+    public String getCrcLogo() {
+        InputStream is = getClass().getClassLoader().getResourceAsStream("images/logo_customer.png");
+        try {
+            String shaLogo = LicUtils.sha256(IOUtils.toByteArray(is), LOGO_SECRET);
+            return shaLogo;
+        } catch (IOException e) {
+            LOG.warn("Customer logo was not found in images/logo_customer.png");
+            return null;
+        }
+    }
 
-	public void validateLogo(RequestBean reqBean) throws SeCurisException {
-		if (reqBean.getCrcLogo() == null) {
-			LOG.info("Customer logo is not included in license file and won't be validated");
-		} else {
-			String currentCRC = getCrcLogo();
-			if (!currentCRC.equals(reqBean.getCrcLogo()))
-				throw new SeCurisException("License logo validation failed for request data: " + JsonUtils.toJSON(reqBean));
-		}
-	}
+    public void validateLogo(RequestBean reqBean) throws SeCurisException {
+        if (reqBean.getCrcLogo() == null) {
+            LOG.info("Customer logo is not included in license file and won't be validated");
+        } else {
+            String currentCRC = getCrcLogo();
+            if (!currentCRC.equals(reqBean.getCrcLogo()))
+                throw new SeCurisException("License logo validation failed for request data: " + JsonUtils.toJSON(reqBean));
+        }
+    }
 
-	public void validateHW(RequestBean reqBean, String appCode, String customerCode) throws SeCurisException {
-		RequestBean currentHW = ReqGenerator.getInstance().createRequest(appCode, customerCode);
-		if (!currentHW.match(reqBean)) {
-			throw new SeCurisException("Current System info mismatch the License System info:\n Licensed: " + JsonUtils.toJSON(reqBean, true) + "\n Expected: " + JsonUtils.toJSON(currentHW, true));
-		}
-	}
+    public void validateHW(RequestBean reqBean, String appCode, String customerCode, String packCode) throws SeCurisException {
+        RequestBean currentHW = ReqGenerator.getInstance().createRequest(appCode, customerCode, packCode);
+        if (!currentHW.match(reqBean)) {
+            throw new SeCurisException("Current System info mismatch the License System info:\n Licensed: " + JsonUtils.toJSON(reqBean, true)
+                    + "\n Expected: " + JsonUtils.toJSON(currentHW, true));
+        }
+    }
 
 }

--
Gitblit v1.3.2