java.lang.Object
io.john.amiscaray.quak.security.auth.jwt.JwtUtil
Used to manage and produce JWTs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractSubject(String token) Extracts the subject of a JWT.generateToken(Principal principal) Generates a token from the user'sPrincipal.booleanisTokenExpired(String token) Checks if a JWT is expired.com.auth0.jwt.interfaces.DecodedJWTvalidateTokenAndGetDecoded(String token) Validates and decodes a given JWT.
-
Constructor Details
-
JwtUtil
-
-
Method Details
-
generateToken
Generates a token from the user'sPrincipal.- Parameters:
principal- The user's principal.- Returns:
- The JWT token as a String.
-
validateTokenAndGetDecoded
Validates and decodes a given JWT.- Parameters:
token- The JWT as a String.- Returns:
- The decoded JWT.
-
extractSubject
Extracts the subject of a JWT.- Parameters:
token- The JWT.- Returns:
- The subject (the security ID of the user).
-
isTokenExpired
Checks if a JWT is expired.- Parameters:
token- The JWT.- Returns:
- Whether the token is expired.
-