TokenPolicy { @JsonIgnore public Map<String, String> getKeys() { return this.keys == null ? Collections.EMPTY_MAP : new HashMap<>(this.keys); } TokenPolicy();  TokenPolicy(int accessTokenValidity, int refreshTokenValidity);  TokenPolicy(int accessTokenValidity, int refreshTokenValidity, Map<String, ? extends Map<String, String>> signingKeysMap); int getAccessTokenValidity(); void setAccessTokenValidity(int accessTokenValidity); int getRefreshTokenValidity(); void setRefreshTokenValidity(int refreshTokenValidity); @JsonIgnore Map<String, String> getKeys(); @JsonIgnore void setKeys(Map<String, String> keys); boolean isRefreshTokenUnique(); void setRefreshTokenUnique(boolean refreshTokenUnique); String getRefreshTokenFormat(); void setRefreshTokenFormat(String refreshTokenFormat); String getActiveKeyId(); void setActiveKeyId(String activeKeyId); boolean isJwtRevocable(); void setJwtRevocable(boolean jwtRevocable);  }
@Test public void deserializationOfTokenPolicyWithVerificationKey_doesNotFail() { String jsonTokenPolicy = "{\"keys\":{\"key-id-1\":{\"verificationKey\":\"some-verification-key-1\",\"signingKey\":\"some-signing-key-1\"}}}"; TokenPolicy tokenPolicy = JsonUtils.readValue(jsonTokenPolicy, TokenPolicy.class); assertEquals(tokenPolicy.getKeys().get("key-id-1"), "some-signing-key-1"); }
@Test public void deserializationOfTokenPolicyWithNoActiveKeyIdWithMultipleKeys_doesNotFail() { String jsonTokenPolicy = "{\"keys\":{\"key-id-1\":{\"signingKey\":\"some-signing-key-1\"},\"key-id-2\":{\"signingKey\":\"some-signing-key-2\"}}}"; TokenPolicy tokenPolicy = JsonUtils.readValue(jsonTokenPolicy, TokenPolicy.class); assertEquals(tokenPolicy.getKeys().get("key-id-1"), "some-signing-key-1"); assertEquals(tokenPolicy.getKeys().get("key-id-2"), "some-signing-key-2"); }