Answer the question
In order to leave comments, you need to log in
How to check Jwt(Keycloak) for validity?
How to check that JWT is not compromised?
At the entrance I get a token with information about the user
***
The first thing that came to mind
String[] chunks = token.split("\\.");
Base64.Decoder decoder = Base64.getUrlDecoder();
String palyload = new String(decoder.decode(chunks[1]));
String header = new String(decoder.decode(chunks[0]));
String unsignedToken = new String(Base64.getEncoder().encode(header)) + '.' + new String(Base64.getEncoder().encode(payload));
HMAC-SHA256(unsignedToken, SECRET_KEY)
Answer the question
In order to leave comments, you need to log in
The application must know the SECRET_KEY, it must not be transmitted over the network. Well, it's better to take a ready-made library for working with JWT, and not reinvent the wheel.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question