Search in sources :

Example 6 with JwsHeader

use of org.forgerock.json.jose.jws.JwsHeader in project OpenAM by OpenRock.

the class PolicyRequestTest method getJwtSubject.

private Jwt getJwtSubject(final String subjectName) {
    JwsHeader header = new JwsHeader(Collections.<String, Object>emptyMap());
    JwtClaimsSet claims = new JwtClaimsSet();
    claims.setSubject(subjectName);
    SigningHandler handler = new NOPSigningHandler();
    return new SignedJwt(header, claims, handler);
}
Also used : JwtClaimsSet(org.forgerock.json.jose.jwt.JwtClaimsSet) JwsHeader(org.forgerock.json.jose.jws.JwsHeader) NOPSigningHandler(org.forgerock.json.jose.jws.handlers.NOPSigningHandler) SignedJwt(org.forgerock.json.jose.jws.SignedJwt) NOPSigningHandler(org.forgerock.json.jose.jws.handlers.NOPSigningHandler) SigningHandler(org.forgerock.json.jose.jws.handlers.SigningHandler)

Example 7 with JwsHeader

use of org.forgerock.json.jose.jws.JwsHeader in project OpenAM by OpenRock.

the class OAuth2JwtTest method expirationTimeSetInPastJWTShouldBeInvalid.

@Test
public void expirationTimeSetInPastJWTShouldBeInvalid() {
    JwsHeader header = new JwsHeader(Collections.<String, Object>emptyMap());
    JwtClaimsSet claims = getJwtClaimsSet(VALID_NOT_BEFORE_TIME, INVALID_EXPIRATION_TIME);
    SigningHandler handler = new NOPSigningHandler();
    OAuth2Jwt oAuth2Jwt = getOAuth2Jwt(header, claims, handler);
    assertTrue(!oAuth2Jwt.isValid(handler));
}
Also used : JwtClaimsSet(org.forgerock.json.jose.jwt.JwtClaimsSet) JwsHeader(org.forgerock.json.jose.jws.JwsHeader) NOPSigningHandler(org.forgerock.json.jose.jws.handlers.NOPSigningHandler) SigningHandler(org.forgerock.json.jose.jws.handlers.SigningHandler) NOPSigningHandler(org.forgerock.json.jose.jws.handlers.NOPSigningHandler) Test(org.testng.annotations.Test)

Aggregations

JwsHeader (org.forgerock.json.jose.jws.JwsHeader)7 NOPSigningHandler (org.forgerock.json.jose.jws.handlers.NOPSigningHandler)7 SigningHandler (org.forgerock.json.jose.jws.handlers.SigningHandler)7 JwtClaimsSet (org.forgerock.json.jose.jwt.JwtClaimsSet)7 Test (org.testng.annotations.Test)6 SignedJwt (org.forgerock.json.jose.jws.SignedJwt)1