| .. | .. |
|---|
| 7 | 7 | import java.nio.file.Paths; |
|---|
| 8 | 8 | import java.nio.file.StandardOpenOption; |
|---|
| 9 | 9 | import java.util.Date; |
|---|
| 10 | +import java.util.HashMap; |
|---|
| 11 | +import java.util.Map; |
|---|
| 10 | 12 | |
|---|
| 11 | 13 | import net.curisit.securis.ConnectionManager.Command; |
|---|
| 12 | 14 | import net.curisit.securis.beans.LicenseBean; |
|---|
| .. | .. |
|---|
| 33 | 35 | private static LicenseManager singleton = new LicenseManager(); |
|---|
| 34 | 36 | |
|---|
| 35 | 37 | public static final String PING_MESSAGE = "SeCuris API OK"; |
|---|
| 38 | + public static final String HEADER_LICENSE_NAME_OR_REFERENCE = "X-SECURIS-LIC-NAMEREF"; |
|---|
| 39 | + public static final String HEADER_LICENSE_EMAIL = "X-SECURIS-LIC-EMAIL"; |
|---|
| 36 | 40 | |
|---|
| 37 | 41 | private LicenseManager() {} |
|---|
| 38 | 42 | |
|---|
| .. | .. |
|---|
| 116 | 120 | * @return The license bean returned by the server |
|---|
| 117 | 121 | * @throws SeCurisException |
|---|
| 118 | 122 | */ |
|---|
| 119 | | - public SignedLicenseBean requestLicense() throws SeCurisException { |
|---|
| 123 | + public SignedLicenseBean requestLicense(String nameOrReference, String email) throws SeCurisException { |
|---|
| 120 | 124 | RequestBean req = ReqGenerator.getInstance().createRequest(Params.get(Params.KEYS.APPLICATION_CODE), Params.get(Params.KEYS.CUSTOMER_CODE), |
|---|
| 121 | 125 | Params.get(Params.KEYS.PACK_CODE)); |
|---|
| 122 | 126 | |
|---|
| 123 | | - SignedLicenseBean lic = requestLicenseToServer(req); |
|---|
| 127 | + SignedLicenseBean lic = requestLicenseToServer(req, nameOrReference, email); |
|---|
| 124 | 128 | return lic; |
|---|
| 125 | 129 | } |
|---|
| 126 | 130 | |
|---|
| .. | .. |
|---|
| 160 | 164 | |
|---|
| 161 | 165 | } |
|---|
| 162 | 166 | |
|---|
| 163 | | - private SignedLicenseBean requestLicenseToServer(RequestBean req) throws SeCurisException { |
|---|
| 164 | | - SignedLicenseBean lic = ConnectionManager.getInstance().executePost(Command.CREATE_LIC, SignedLicenseBean.class, req); |
|---|
| 167 | + private SignedLicenseBean requestLicenseToServer(RequestBean req, String nameOrReference, String email) throws SeCurisException { |
|---|
| 168 | + Map<String, String> headers = new HashMap<String, String>(); |
|---|
| 169 | + headers.put(HEADER_LICENSE_NAME_OR_REFERENCE, nameOrReference); |
|---|
| 170 | + headers.put(HEADER_LICENSE_EMAIL, email); |
|---|
| 171 | + SignedLicenseBean lic = ConnectionManager.getInstance().executePost(Command.CREATE_LIC, SignedLicenseBean.class, req, headers); |
|---|
| 165 | 172 | |
|---|
| 166 | 173 | return lic; |
|---|
| 167 | 174 | } |
|---|