use of org.forgerock.json.jose.jwt.JwtClaimsSet in project OpenAM by OpenRock.
the class OAuth2JwtTest method notBeforeTimeSetInPastJWTShouldBeValid.
@Test
public void notBeforeTimeSetInPastJWTShouldBeValid() {
JwsHeader header = new JwsHeader(Collections.<String, Object>emptyMap());
JwtClaimsSet claims = getJwtClaimsSet(VALID_NOT_BEFORE_TIME, VALID_EXPIRATION_TIME);
SigningHandler handler = new NOPSigningHandler();
OAuth2Jwt oAuth2Jwt = getOAuth2Jwt(header, claims, handler);
assertTrue(oAuth2Jwt.isValid(handler));
}
use of org.forgerock.json.jose.jwt.JwtClaimsSet in project OpenAM by OpenRock.
the class OAuth2JwtTest method notBeforeTimeSetAsNowShouldBeValid.
@Test
public void notBeforeTimeSetAsNowShouldBeValid() {
//The skew set in oAuth2Jwt is significant in this test
JwsHeader header = new JwsHeader(Collections.<String, Object>emptyMap());
JwtClaimsSet claims = getJwtClaimsSet(0, VALID_EXPIRATION_TIME);
SigningHandler handler = new NOPSigningHandler();
OAuth2Jwt oAuth2Jwt = getOAuth2Jwt(header, claims, handler);
assertTrue(oAuth2Jwt.isValid(handler));
}
use of org.forgerock.json.jose.jwt.JwtClaimsSet in project OpenAM by OpenRock.
the class OAuth2JwtTest method notBeforeTimeSetInFutureJWTShouldBeInvalid.
@Test
public void notBeforeTimeSetInFutureJWTShouldBeInvalid() {
JwsHeader header = new JwsHeader(Collections.<String, Object>emptyMap());
JwtClaimsSet claims = getJwtClaimsSet(INVALID_NOT_BEFORE_TIME, VALID_EXPIRATION_TIME);
SigningHandler handler = new NOPSigningHandler();
OAuth2Jwt oAuth2Jwt = getOAuth2Jwt(header, claims, handler);
assertTrue(!oAuth2Jwt.isValid(handler));
}
use of org.forgerock.json.jose.jwt.JwtClaimsSet in project OpenAM by OpenRock.
the class OAuth2JwtTest method expirationTimeSetInFutureJWTShouldBeValid.
@Test
public void expirationTimeSetInFutureJWTShouldBeValid() {
JwsHeader header = new JwsHeader(Collections.<String, Object>emptyMap());
JwtClaimsSet claims = getJwtClaimsSet(VALID_NOT_BEFORE_TIME, VALID_EXPIRATION_TIME);
SigningHandler handler = new NOPSigningHandler();
OAuth2Jwt oAuth2Jwt = getOAuth2Jwt(header, claims, handler);
assertTrue(oAuth2Jwt.isValid(handler));
}
use of org.forgerock.json.jose.jwt.JwtClaimsSet in project OpenAM by OpenRock.
the class OAuth2JwtTest method expirationTimeSetAsNowJWTShouldBeValid.
@Test
public void expirationTimeSetAsNowJWTShouldBeValid() {
//The skew set in oAuth2Jwt is significant in this test
JwsHeader header = new JwsHeader(Collections.<String, Object>emptyMap());
JwtClaimsSet claims = getJwtClaimsSet(VALID_NOT_BEFORE_TIME, 0);
SigningHandler handler = new NOPSigningHandler();
OAuth2Jwt oAuth2Jwt = getOAuth2Jwt(header, claims, handler);
assertTrue(oAuth2Jwt.isValid(handler));
}
Aggregations