| .. | .. |
|---|
| 1 | +/* |
|---|
| 2 | + * Copyright @ 2013 CurisTEC, S.A.S. All Rights Reserved. |
|---|
| 3 | + */ |
|---|
| 1 | 4 | package net.curisit.securis; |
|---|
| 2 | 5 | |
|---|
| 3 | 6 | import java.util.Date; |
|---|
| .. | .. |
|---|
| 9 | 12 | import net.curisit.securis.beans.SignedLicenseBean; |
|---|
| 10 | 13 | import net.curisit.securis.utils.JsonUtils; |
|---|
| 11 | 14 | |
|---|
| 15 | +/** |
|---|
| 16 | +* FreeLicenseGenerator |
|---|
| 17 | +* <p> |
|---|
| 18 | +* Helper to generate a signed FREE license (no expiration) for a given app and code. |
|---|
| 19 | +* |
|---|
| 20 | +* @author JRA |
|---|
| 21 | + * Last reviewed by JRA on Oct 5, 2025. |
|---|
| 22 | +*/ |
|---|
| 12 | 23 | public class FreeLicenseGenerator { |
|---|
| 13 | 24 | |
|---|
| 25 | + /** Constant license type code for FREE licenses. */ |
|---|
| 14 | 26 | public static final String FREE_LICENSE_TYPE = "FREE"; |
|---|
| 15 | 27 | |
|---|
| 28 | + /** |
|---|
| 29 | + * generateLicense |
|---|
| 30 | + * <p> |
|---|
| 31 | + * Build and sign a FREE license using the default generator. Uses a <code>Date(-1)</code> |
|---|
| 32 | + * sentinel as "no expiration". |
|---|
| 33 | + * |
|---|
| 34 | + * @param appName application name |
|---|
| 35 | + * @param licCode license code |
|---|
| 36 | + * @param metadata additional metadata to embed |
|---|
| 37 | + * @return signed license bean wrapper |
|---|
| 38 | + * @throws SeCurisException on generation/signature errors |
|---|
| 39 | + */ |
|---|
| 16 | 40 | public static SignedLicenseBean generateLicense(String appName, String licCode, Map<String, Object> metadata) throws SeCurisException { |
|---|
| 17 | 41 | SignedLicenseBean sl = null; |
|---|
| 18 | 42 | RequestBean rb = new RequestBean(); |
|---|
| .. | .. |
|---|
| 24 | 48 | return sl; |
|---|
| 25 | 49 | } |
|---|
| 26 | 50 | |
|---|
| 51 | + |
|---|
| 52 | + /** |
|---|
| 53 | + * Demo main |
|---|
| 54 | + * |
|---|
| 55 | + * @param args |
|---|
| 56 | + * @throws SeCurisException |
|---|
| 57 | + */ |
|---|
| 27 | 58 | public static void main(String[] args) throws SeCurisException { |
|---|
| 28 | 59 | Map<String, Object> metadata = new HashMap<>(); |
|---|
| 29 | 60 | metadata.put("max_docs", 2000); |
|---|