rsanchez
2015-09-02 58c478551bb9480fdfa7d02edc6e1d941239f810
#2734 fix - Added control to prevent lic preactivation on wrong request
data
2 files modified
changed files
securis/pom.xml patch | view | blame | history
securis/src/main/java/net/curisit/securis/services/ApiResource.java patch | view | blame | history
securis/pom.xml
....@@ -3,7 +3,7 @@
33 <modelVersion>4.0.0</modelVersion>
44 <groupId>net.curisit</groupId>
55 <artifactId>securis-server</artifactId>
6
- <version>1.0.1</version>
6
+ <version>1.0.2</version>
77 <name>SeCuris</name>
88 <description>CurisTEC Server Licenses</description>
99 <dependencies>
securis/src/main/java/net/curisit/securis/services/ApiResource.java
....@@ -239,6 +239,7 @@
239239
240240 /**
241241 * Returns a new License file in JSON format based in a previous license
242
+ * There is 2 /renew services with json input and with upload file
242243 *
243244 * @param mpfdi
244245 * @param bsc
....@@ -301,9 +302,7 @@
301302 if (lic.getStatus() != LicenseStatus.ACTIVE && lic.getStatus() != LicenseStatus.PRE_ACTIVE) {
302303 throw new SeCurisServiceException(ErrorCodes.INVALID_DATA, "The current license has been cancelled");
303304 }
304
- }
305
-
306
- if (!renew) {
305
+ } else {
307306 try {
308307 lic = License.findValidLicenseByRequestData(JsonUtils.toJSON(req), em);
309308 } catch (SeCurisException e1) {
....@@ -334,6 +333,14 @@
334333 }
335334 if (!renew && lic.getStatus() == LicenseStatus.REQUESTED && !pack.isLicensePreactivation()) {
336335 throw new SeCurisServiceException(ErrorCodes.NO_AVAILABLE_LICENSES, "Current pack doesn't allow license preactivation");
336
+ }
337
+
338
+ if (!req.getCustomerCode().equals(pack.getOrganization().getCode())) {
339
+ throw new SeCurisServiceException(ErrorCodes.INVALID_LICENSE_REQUEST_DATA, "Customer code is not valid: " + req.getCustomerCode());
340
+ }
341
+
342
+ if (!req.getLicenseTypeCode().equals(pack.getLicenseTypeCode())) {
343
+ throw new SeCurisServiceException(ErrorCodes.INVALID_LICENSE_REQUEST_DATA, "License type code is not valid: " + req.getLicenseTypeCode());
337344 }
338345
339346 SignedLicenseBean signedLicense;
....@@ -399,5 +406,4 @@
399406
400407 return signedLicense;
401408 }
402
-
403409 }