Class Servlet5JwtAuthenticationEngine
java.lang.Object
io.telicent.servlet.auth.jwt.JwtAuthenticationEngine<TRequest,TResponse>
io.telicent.servlet.auth.jwt.HeaderBasedJwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
io.telicent.servlet.auth.jwt.servlet5.Servlet5JwtAuthenticationEngine
public class Servlet5JwtAuthenticationEngine
extends HeaderBasedJwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
A JSON Web Token (JWT) authentication engine for use with
jakarta.servlet based applications-
Field Summary
Fields inherited from class io.telicent.servlet.auth.jwt.HeaderBasedJwtAuthenticationEngine
headers, realm, usernameClaimsFields inherited from class io.telicent.servlet.auth.jwt.JwtAuthenticationEngine
NO_AUTH_TOKEN_FOUND -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new authentication engine using default configurationServlet5JwtAuthenticationEngine(Collection<HeaderSource> headers, String realm, Collection<String> usernameClaims) Creates a new authentication engine using the provided configuration -
Method Summary
Modifier and TypeMethodDescriptionprotected List<TokenCandidate>extractTokens(jakarta.servlet.http.HttpServletRequest request) protected StringgetRequestUrl(jakarta.servlet.http.HttpServletRequest request) protected booleanhasRequiredParameters(jakarta.servlet.http.HttpServletRequest request) protected jakarta.servlet.http.HttpServletRequestprepareRequest(jakarta.servlet.http.HttpServletRequest request, io.jsonwebtoken.Jws<io.jsonwebtoken.Claims> jws, String username) protected voidsendChallenge(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Challenge challenge) protected voidprotected voidsetRequestAttribute(jakarta.servlet.http.HttpServletRequest request, String attribute, Object value) Methods inherited from class io.telicent.servlet.auth.jwt.HeaderBasedJwtAuthenticationEngine
extractUsername, selectRealm, toStringMethods inherited from class io.telicent.servlet.auth.jwt.JwtAuthenticationEngine
authenticate, buildAuthorizationHeader, buildChallengeParameters
-
Constructor Details
-
Servlet5JwtAuthenticationEngine
public Servlet5JwtAuthenticationEngine()Creates a new authentication engine using default configuration -
Servlet5JwtAuthenticationEngine
public Servlet5JwtAuthenticationEngine(Collection<HeaderSource> headers, String realm, Collection<String> usernameClaims) Creates a new authentication engine using the provided configuration- Parameters:
headers- Header sourcesrealm- RealmusernameClaims- Username claims
-
-
Method Details
-
hasRequiredParameters
protected boolean hasRequiredParameters(jakarta.servlet.http.HttpServletRequest request) - Specified by:
hasRequiredParametersin classJwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
-
extractTokens
- Specified by:
extractTokensin classJwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
-
prepareRequest
protected jakarta.servlet.http.HttpServletRequest prepareRequest(jakarta.servlet.http.HttpServletRequest request, io.jsonwebtoken.Jws<io.jsonwebtoken.Claims> jws, String username) - Specified by:
prepareRequestin classJwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
-
sendChallenge
protected void sendChallenge(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, Challenge challenge) - Specified by:
sendChallengein classJwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
-
sendError
- Specified by:
sendErrorin classJwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
-
getRequestUrl
- Specified by:
getRequestUrlin classJwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
-
setRequestAttribute
protected void setRequestAttribute(jakarta.servlet.http.HttpServletRequest request, String attribute, Object value) - Specified by:
setRequestAttributein classJwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
-