I have a public and private key to create a JWT token. With the private key, I create a JWT token, and with the public key, I check the validity of the token. To create a token on the server side, I use the following code:
Jwts.builder()
.setHeaderParam("typ","JWT")
.claim("email", userPrincipal.getEmail())
.claim("roles", roleList)
.setIssuedAt(new Date())
.setExpiration(new Date(new Date().getTime() + jwtExpirationMs))
.signWith(getPrivateKey(), SignatureAlgorithm.RS512)
.compact();
To check the validity of the token on the server side, I use the public key and the following code:
Jwts.parserBuilder().setSigningKey(getPublicKey()).build().parseClaimsJws(jwtString);
Now my task is to check the validity of the token on the Angular client side.
Please tell me how can this be done?