| .. | .. |
|---|
| 16 | 16 | |
|---|
| 17 | 17 | private static final Logger log = LogManager.getLogger(LicenseValidator.class); |
|---|
| 18 | 18 | |
|---|
| 19 | | - public static LicenseValidator singleton = new LicenseValidator(); |
|---|
| 20 | | - public static byte[] LOGO_SECRET; |
|---|
| 19 | + private static LicenseValidator singleton = new LicenseValidator(); |
|---|
| 20 | + protected static byte[] LOGO_SECRET; |
|---|
| 21 | 21 | |
|---|
| 22 | | - private LicenseValidator() { |
|---|
| 22 | + static { |
|---|
| 23 | 23 | try { |
|---|
| 24 | 24 | LOGO_SECRET = "Logo ipsum s3cr3t test áíóú".getBytes("utf-8"); |
|---|
| 25 | 25 | } catch (UnsupportedEncodingException e) { |
|---|
| 26 | 26 | log.error("Unexpected error getting LOGO secret", e); |
|---|
| 27 | 27 | } |
|---|
| 28 | + } |
|---|
| 29 | + |
|---|
| 30 | + private LicenseValidator() { |
|---|
| 28 | 31 | } |
|---|
| 29 | 32 | |
|---|
| 30 | 33 | public static LicenseValidator getInstance() { |
|---|
| .. | .. |
|---|
| 57 | 60 | |
|---|
| 58 | 61 | public void validateHW(RequestBean reqBean, String appCode, String customerCode) throws SeCurisException { |
|---|
| 59 | 62 | RequestBean currentHW = ReqGenerator.getInstance().createRequest(appCode, customerCode); |
|---|
| 60 | | - if (!currentHW.match(reqBean)) |
|---|
| 63 | + if (!currentHW.match(reqBean)) { |
|---|
| 61 | 64 | throw new SeCurisException("Current System info mismatch the License System info:\n Licensed: " + JsonUtils.toJSON(reqBean, true) + "\n Expected: " + JsonUtils.toJSON(currentHW, true)); |
|---|
| 65 | + } |
|---|
| 62 | 66 | } |
|---|
| 63 | 67 | |
|---|
| 64 | 68 | } |
|---|