AccessToken extends OAuth2Token { public AccessToken() { super(); } AccessToken();  AccessToken(final String token, JwtsSigningKeyResolver keyResolver);  AccessToken(final String token, PublicKey publicKey);  AccessToken(final String token, JwtsSigningKeyResolver keyResolver,
                       X509Certificate x509Cert);  AccessToken(final String token, JwtsSigningKeyResolver keyResolver,
                       X509Certificate x509Cert, final String x509CertHash); static void setAccessTokenCertOffset(long offset); static void setAccessTokenProxyPrincipals(Set<String> proxyPrincipals); String getClientId(); void setClientId(String clientId); String getProxyPrincipal(); void setProxyPrincipal(String proxyPrincipal); String getUserId(); void setUserId(String userId); List<String> getScope(); void setScope(List<String> scope); LinkedHashMap<String, Object> getConfirm(); void setConfirm(LinkedHashMap<String, Object> confirm); void setConfirmEntry(final String key, final Object value); void setConfirmX509CertHash(X509Certificate cert); boolean confirmMTLSBoundToken(X509Certificate x509Cert, final String x509CertHash); Object getConfirmEntry(final String key); String getSignedToken(final PrivateKey key, final String keyId,
            final SignatureAlgorithm keyAlg); static final String HDR_TOKEN_TYPE; static final String HDR_TOKEN_JWT; static final String CLAIM_SCOPE; static final String CLAIM_UID; static final String CLAIM_CLIENT_ID; static final String CLAIM_CONFIRM; static final String CLAIM_PROXY; static final String CLAIM_CONFIRM_X509_HASH; }
@Test public void testAccessToken() { long now = System.currentTimeMillis() / 1000; AccessToken accessToken = createAccessToken(now); validateAccessToken(accessToken, now); PrivateKey privateKey = Crypto.loadPrivateKey(ecPrivateKey); String accessJws = accessToken.getSignedToken(privateKey, "eckey1", SignatureAlgorithm.ES256); assertNotNull(accessJws); PublicKey publicKey = Crypto.loadPublicKey(ecPublicKey); Jws<Claims> claims = Jwts.parserBuilder().setSigningKey(publicKey).build().parseClaimsJws(accessJws); assertNotNull(claims); assertEquals("subject", claims.getBody().getSubject()); assertEquals("coretech", claims.getBody().getAudience()); assertEquals("athenz", claims.getBody().getIssuer()); List<String> scopes = (List<String>) claims.getBody().get("scp"); assertNotNull(scopes); assertEquals(1, scopes.size()); assertEquals("readers", scopes.get(0)); }