Class JwtService
java.lang.Object
com.eurodyn.qlack.util.jwt.service.JwtService
A service allowing creation, validation, and claims management in JWTs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongenerateJwt
(JwtGenerateRequestDTO request) Generates a JWT encapsulating the requested paramaters including any number of custom claims.Returns the claims of a JWT.static String
getRawToken
(jakarta.servlet.http.HttpServletRequest request) Extracts the JWT from am `Authorization` HTTP header.
-
Constructor Details
-
JwtService
-
-
Method Details
-
generateJwt
Generates a JWT encapsulating the requested paramaters including any number of custom claims.- Parameters:
request
- The details of the JWT to be generated.- Returns:
- Returns a compacted JWT encapsulating the specified details as per JWT Compact Serialization
-
getClaims
Returns the claims of a JWT. This method automatically validates the JWT before a claim is returned.- Parameters:
jwt
- The compacted JWT to validate.- Returns:
- Returns the claims of the JWT, or an encapsulated error message explaining what went wrong when trying to validatete the JWT.
-
getRawToken
Extracts the JWT from am `Authorization` HTTP header. The JWT is expected to be prefixed with the word `Bearer`.- Parameters:
request
- TheHttpServletRequest
bearing the JWT.
-