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
  • 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 sources
      realm - Realm
      usernameClaims - Username claims
  • Method Details

    • hasRequiredParameters

      protected boolean hasRequiredParameters(jakarta.servlet.http.HttpServletRequest request)
      Specified by:
      hasRequiredParameters in class JwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
    • extractTokens

      protected List<TokenCandidate> extractTokens(jakarta.servlet.http.HttpServletRequest request)
      Specified by:
      extractTokens in class JwtAuthenticationEngine<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:
      prepareRequest in class JwtAuthenticationEngine<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:
      sendChallenge in class JwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
    • sendError

      protected void sendError(jakarta.servlet.http.HttpServletResponse response, Throwable err)
      Specified by:
      sendError in class JwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
    • getRequestUrl

      protected String getRequestUrl(jakarta.servlet.http.HttpServletRequest request)
      Specified by:
      getRequestUrl in class JwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>
    • setRequestAttribute

      protected void setRequestAttribute(jakarta.servlet.http.HttpServletRequest request, String attribute, Object value)
      Specified by:
      setRequestAttribute in class JwtAuthenticationEngine<jakarta.servlet.http.HttpServletRequest,jakarta.servlet.http.HttpServletResponse>