use of io.helidon.security.jwt.SignedJwt in project helidon by oracle.
the class JsonWebTokenImplTest method testGetClaim.
@Test
void testGetClaim() {
Jwt jwt = Jwt.builder().issuer("issuer").subject("subject").addUserGroup("users").addUserGroup("admins").build();
SignedJwt signed = SignedJwt.sign(jwt, Jwk.NONE_JWK);
JsonWebTokenImpl impl = JsonWebTokenImpl.create(signed);
assertAll(() -> testClaimType(impl, Claims.sub), () -> testClaimType(impl, Claims.groups), () -> testClaimType(impl, Claims.iss));
}
use of io.helidon.security.jwt.SignedJwt in project helidon by oracle.
the class JsonWebTokenImplTest method testUpnFromSub.
@Test
void testUpnFromSub() {
String name = "me@example.org";
Jwt jwt = Jwt.builder().subject(name).build();
SignedJwt signed = SignedJwt.sign(jwt, Jwk.NONE_JWK);
JsonWebTokenImpl impl = JsonWebTokenImpl.create(signed);
assertThat(impl.getName(), is(name));
assertThat(impl.getClaim(Claims.upn.name()), is(name));
}
Aggregations