Class AbstractBearerTokenExtractor


  • public abstract class AbstractBearerTokenExtractor
    extends Object
    Common functionality for classes extracting Bearer tokens from HTTP request headers (including Cookie) and converting the token string to a JsonWebToken.
    Author:
    Michael Edgar <michael@xlate.io>
    • Constructor Detail

      • AbstractBearerTokenExtractor

        protected AbstractBearerTokenExtractor​(JWTAuthContextInfo authContextInfo)
    • Method Detail

      • getBearerToken

        public String getBearerToken()
        Find a JWT Bearer token in the request by referencing the configurations found in the JWTAuthContextInfo. The resulting token may be found in a cookie or another HTTP header, either explicitly configured or the default 'Authorization' header.
        Returns:
        a JWT Bearer token or null if not found
      • getHeaderValue

        protected abstract String getHeaderValue​(String headerName)
        Retrieve an HTTP request header by name.
        Parameters:
        headerName - name of the header
        Returns:
        value of the header
      • getCookieValue

        protected abstract String getCookieValue​(String cookieName)
        Retrieve an HTTP request cookie value by name.
        Parameters:
        cookieName - name of the cookie
        Returns:
        value of the cookie