@Test
    public void testGenerateAuthenticate() {
        val signingSecret = CommonHelper.randomString(32);
        val encryptionSecret = CommonHelper.randomString(32);
        val generator = new JwtGenerator(new SecretSignatureConfiguration(signingSecret, JWSAlgorithm.HS256),
            new SecretEncryptionConfiguration(encryptionSecret, JWEAlgorithm.DIR, EncryptionMethod.A128CBC_HS256));
        val casRestProfile = new CasRestProfile(TGT_ID, USERNAME);
        assertNotNull(casRestProfile.getTicketGrantingTicketId());

        var token = generator.generate(casRestProfile);
        val jwtAuthenticator = new JwtAuthenticator(new SecretSignatureConfiguration(signingSecret, JWSAlgorithm.HS256),
            new SecretEncryptionConfiguration(encryptionSecret, JWEAlgorithm.DIR, EncryptionMethod.A128CBC_HS256));
        jwtAuthenticator.setExpirationTime(Date.from(Instant.now().plusSeconds(5 * 60)));
        val newCasProfile = (CasRestProfile) jwtAuthenticator.validateToken(token);
        assertEquals(TGT_ID, newCasProfile.getTicketGrantingTicketId());
    }
Tests the CasRestProfile in JWT generation/authentication.

@author Jerome LELEU
@since 3.7.0
pac4j-jwt/src/test/java/org/pac4j/jwt/CasRestProfileJwtTest.java