| .. | .. |
|---|
| 10 | 10 | import java.security.spec.InvalidKeySpecException; |
|---|
| 11 | 11 | import java.text.MessageFormat; |
|---|
| 12 | 12 | import java.util.Date; |
|---|
| 13 | +import java.util.Map; |
|---|
| 13 | 14 | |
|---|
| 14 | 15 | import net.curisit.securis.beans.LicenseBean; |
|---|
| 15 | 16 | import net.curisit.securis.beans.RequestBean; |
|---|
| .. | .. |
|---|
| 25 | 26 | */ |
|---|
| 26 | 27 | public class LicenseGenerator { |
|---|
| 27 | 28 | |
|---|
| 28 | | - @SuppressWarnings("unused") |
|---|
| 29 | 29 | private static final Logger log = LoggerFactory.getLogger(LicenseGenerator.class); |
|---|
| 30 | 30 | |
|---|
| 31 | 31 | private static LicenseGenerator singleton = new LicenseGenerator(); |
|---|
| .. | .. |
|---|
| 50 | 50 | * @return |
|---|
| 51 | 51 | * @throws SeCurisException |
|---|
| 52 | 52 | */ |
|---|
| 53 | | - public LicenseBean generateLicense(RequestBean req, int maxUsers, Date expirationDate) throws SeCurisException { |
|---|
| 53 | + public LicenseBean generateLicense(RequestBean req, Map<String, Object> metadata, Date expirationDate, String licenseCode) throws SeCurisException { |
|---|
| 54 | 54 | log.info(MessageFormat.format("Generating license: MAC: {0}, Customer code: {1}, AppCode: {2}", req.getMacAddresses(), req.getCustomerCode(), req.getAppCode())); |
|---|
| 55 | 55 | LicenseBean license = new LicenseBean(req); |
|---|
| 56 | + license.setLicenseCode(licenseCode); |
|---|
| 56 | 57 | license.setExpirationDate(expirationDate); |
|---|
| 57 | | - license.setMaxUsers(maxUsers); |
|---|
| 58 | + license.setMetadata(metadata); |
|---|
| 58 | 59 | sign(license); |
|---|
| 59 | 60 | |
|---|
| 60 | 61 | return license; |
|---|