-
- Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
Hub 1.5.0 introduced the "org.cryptomator.hub.entitlements" claim which includes "seats". We still have the non-nested "seats" claim for backwards compatibility.
-
var licensedSeats = jwt.getClaim("seats").asInt(); // TODO eventually replace with "org.cryptomator.hub.entitlements"."seats", see https://github.com/cryptomator/hub/issues/391 -
hub/backend/src/main/java/org/cryptomator/hub/license/LicenseHolder.java
Lines 204 to 210 in 27e3798
var entitlements = license.getClaim("org.cryptomator.hub.entitlements").as(HubLicenseEntitlements.class); // TODO: eventually "entitlements" claim will be mandatory and this fallback can be removed, see https://github.com/cryptomator/hub/issues/391 if (entitlements == null) { // legacy (pre 1.5.0) license without "org.cryptomator.hub.entitlements" claim: return HubLicenseEntitlements.create().withSeats(license.getClaim("seats").asLong()); } else { return entitlements; } -
private static final String[] REQUIRED_CLAIMS = {"seats"}; // TODO: eventually phase out "seats" claim in favor of "org.cryptomator.hub.entitlements"."seats", see https://github.com/cryptomator/hub/issues/391 -
hub/backend/src/test/java/org/cryptomator/hub/license/LicenseValidatorTest.java
Lines 29 to 42 in 27e3798
@Test @DisplayName("validate valid legacy token (pre org.cryptomator.hub.entitlements)") // TODO: eventually remove this test when legacy tokens are no longer supported, see https://github.com/cryptomator/hub/issues/391 void testValidateValidToken() { var jwt = validator.validate(VALID_LEGACY_TOKEN, "42"); Assertions.assertEquals("ES512", jwt.getAlgorithm()); Assertions.assertEquals("42", jwt.getId()); Assertions.assertEquals("Skymatic", jwt.getIssuer()); Assertions.assertEquals("Cryptomator Hub", jwt.getAudience().get(0)); Assertions.assertEquals("hub@cryptomator.org", jwt.getSubject()); Assertions.assertEquals(5, jwt.getClaim("seats").asInt()); Assertions.assertEquals(253402214400l, jwt.getExpiresAt().getTime() / 1000); Assertions.assertEquals("http://localhost:8787/hub/subscription?hub_id=42", jwt.getClaim("refreshUrl").asString()); }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels