@Test
    public void testNestedClaimsJwt() {
        val generator = new JwtGenerator(new SecretSignatureConfiguration(MAC_SECRET));
        Map<String, Object> claimsMap = new HashMap<>();
        claimsMap.put("userData", Map.of("id", "123345", "name", "pac4j"));
        claimsMap.put("iss", "https://pac4j.org");
        claimsMap.put("jti", "JTI");
        claimsMap.put("iat", new Date().getTime());
        claimsMap.put("exp", new Date().getTime() + 10_000);
        claimsMap.put("sub", "pac4j");

        var token = generator.generate(claimsMap);
        val credentials = new TokenCredentials(token);
        Authenticator authenticator = new JwtAuthenticator(new SecretSignatureConfiguration(MAC_SECRET));
        authenticator.validate(null, credentials);
        assertNotNull(credentials.getUserProfile());
        assertTrue(credentials.getUserProfile().containsAttribute("id"));
        assertTrue(credentials.getUserProfile().containsAttribute("name"));
        assertTrue(credentials.getUserProfile().containsAttribute("userData"));
    }
This class tests the {@link JwtGenerator} and {@link JwtAuthenticator}.

@author Jerome Leleu
@since 1.8.0
pac4j-jwt/src/test/java/org/pac4j/jwt/JwtTests.java