Class Servlet3JwtAuthenticationEngine

java.lang.Object
io.telicent.servlet.auth.jwt.JwtAuthenticationEngine<TRequest,TResponse>
io.telicent.servlet.auth.jwt.HeaderBasedJwtAuthenticationEngine<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
io.telicent.servlet.auth.jwt.servlet3.Servlet3JwtAuthenticationEngine

public class Servlet3JwtAuthenticationEngine extends io.telicent.servlet.auth.jwt.HeaderBasedJwtAuthenticationEngine<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
A JSON Web Token (JWT) authentication engine for use with javax.servlet based applications
  • Field Summary

    Fields inherited from class io.telicent.servlet.auth.jwt.HeaderBasedJwtAuthenticationEngine

    headers, realm, rolesClaim, UNEXPECTED_ERROR_MESSAGE, usernameClaims

    Fields inherited from class io.telicent.servlet.auth.jwt.JwtAuthenticationEngine

    NO_AUTH_TOKEN_FOUND
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new authentication engine with default configuration
    Servlet3JwtAuthenticationEngine(Collection<io.telicent.servlet.auth.jwt.sources.HeaderSource> headers, String realm, Collection<io.telicent.servlet.auth.jwt.configuration.ClaimPath> usernameClaims, io.telicent.servlet.auth.jwt.configuration.ClaimPath rolesClaim)
    Creates a new authentication engine using the provided configuration
  • Method Summary

    Modifier and Type
    Method
    Description
    protected List<io.telicent.servlet.auth.jwt.challenges.TokenCandidate>
    extractTokens(javax.servlet.http.HttpServletRequest request)
     
    protected String
    getRequestUrl(javax.servlet.http.HttpServletRequest request)
     
    protected boolean
    hasRequiredParameters(javax.servlet.http.HttpServletRequest request)
     
    protected javax.servlet.http.HttpServletRequest
    prepareRequest(javax.servlet.http.HttpServletRequest request, io.jsonwebtoken.Jws<io.jsonwebtoken.Claims> jws, String username)
     
    protected void
    sendChallenge(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, io.telicent.servlet.auth.jwt.challenges.Challenge challenge)
     
    protected void
    sendError(javax.servlet.http.HttpServletResponse response, Throwable err)
     
    protected void
    setRequestAttribute(javax.servlet.http.HttpServletRequest request, String attribute, Object value)
     

    Methods inherited from class io.telicent.servlet.auth.jwt.HeaderBasedJwtAuthenticationEngine

    extractUsername, selectRealm, toString

    Methods inherited from class io.telicent.servlet.auth.jwt.JwtAuthenticationEngine

    authenticate, buildAuthorizationHeader, buildChallengeParameters

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Servlet3JwtAuthenticationEngine

      public Servlet3JwtAuthenticationEngine()
      Creates a new authentication engine with default configuration
    • Servlet3JwtAuthenticationEngine

      public Servlet3JwtAuthenticationEngine(Collection<io.telicent.servlet.auth.jwt.sources.HeaderSource> headers, String realm, Collection<io.telicent.servlet.auth.jwt.configuration.ClaimPath> usernameClaims, io.telicent.servlet.auth.jwt.configuration.ClaimPath rolesClaim)
      Creates a new authentication engine using the provided configuration
      Parameters:
      headers - Header sources
      realm - Realm
      usernameClaims - Username claims
      rolesClaim - Roles claim
  • Method Details

    • hasRequiredParameters

      protected boolean hasRequiredParameters(javax.servlet.http.HttpServletRequest request)
      Specified by:
      hasRequiredParameters in class io.telicent.servlet.auth.jwt.JwtAuthenticationEngine<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
    • extractTokens

      protected List<io.telicent.servlet.auth.jwt.challenges.TokenCandidate> extractTokens(javax.servlet.http.HttpServletRequest request)
      Specified by:
      extractTokens in class io.telicent.servlet.auth.jwt.JwtAuthenticationEngine<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
    • prepareRequest

      protected javax.servlet.http.HttpServletRequest prepareRequest(javax.servlet.http.HttpServletRequest request, io.jsonwebtoken.Jws<io.jsonwebtoken.Claims> jws, String username)
      Specified by:
      prepareRequest in class io.telicent.servlet.auth.jwt.JwtAuthenticationEngine<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
    • sendChallenge

      protected void sendChallenge(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, io.telicent.servlet.auth.jwt.challenges.Challenge challenge)
      Specified by:
      sendChallenge in class io.telicent.servlet.auth.jwt.JwtAuthenticationEngine<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
    • sendError

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

      protected String getRequestUrl(javax.servlet.http.HttpServletRequest request)
      Specified by:
      getRequestUrl in class io.telicent.servlet.auth.jwt.JwtAuthenticationEngine<javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse>
    • setRequestAttribute

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