To verify and parse the jwt token the code is
public static Claims decodeJWT(String jwt) {
//This line will throw an exception if it is not a signed JWS (as expected)
Claims claims = Jwts.parser()
.setSigningKey(DatatypeConverter.parseBase64Binary(SECRET_KEY))
.parseClaimsJws(jwt).getBody();
return claims;
}
My jwk looks like
public class MyJwkDto {
String kty;
String crv;
String kid;
String x;
String y;
}
as exaple
{
"kty": "EC",
"crv": "P-256",
"kid": "UD9Jr8TKPk3MI_RQg2LX3UFwaV4U3nhIzUO_pU78q4M",
"x": "lKgBPjCtzRiYOC1Oyi_3qi6Ux7Wcxaem35nx9IgEqRY",
"y": "fNghfAOzpsSudHo6tq1JB3FdKkdQnH_tLj2tajc8ZUM"
}
But what do I use now for the SECRET_KEY?
So what i did is:
First changed the lib from jjwt to nimbus-jose-jwt. After that I stored the jwks as .a JWKSet
After that the validation of a jwk worked as follows
Thanks to @jps