Class JWTRequestParameterAuthenticationFilter

  • All Implemented Interfaces:
    javax.servlet.Filter, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.EnvironmentAware, org.springframework.web.context.ServletContextAware

    public class JWTRequestParameterAuthenticationFilter
    extends org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter
    Authentication filter for JWTs in request parameters. What exactly this means depends on the request method. Specifically, for GET requests, the JWT is looked up in the query parameters. For POST this expects a form body and the JWT is read from there.
    • Field Summary

      • Fields inherited from class org.springframework.web.filter.GenericFilterBean

        logger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterPropertiesSet()  
      protected Object getPreAuthenticatedCredentials​(javax.servlet.http.HttpServletRequest request)  
      protected Object getPreAuthenticatedPrincipal​(javax.servlet.http.HttpServletRequest request)  
      void setDebug​(boolean debug)
      Setter for the debug switch.
      void setExceptionIfParameterMissing​(boolean exceptionIfParameterMissing)
      Defines whether an exception should be raised if the principal parameter is missing.
      void setLoginHandler​(JWTLoginHandler loginHandler)
      Setter for the login handler.
      void setParameterName​(String parameterName)
      Setter for the parameter name.
      • Methods inherited from class org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter

        doFilter, getAuthenticationDetailsSource, setApplicationEventPublisher, setAuthenticationDetailsSource, setAuthenticationManager, setCheckForPrincipalChanges, setContinueFilterChainOnUnsuccessfulAuthentication, setInvalidateSessionOnPrincipalChange, successfulAuthentication, unsuccessfulAuthentication
      • Methods inherited from class org.springframework.web.filter.GenericFilterBean

        addRequiredProperty, destroy, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
    • Constructor Detail

      • JWTRequestParameterAuthenticationFilter

        public JWTRequestParameterAuthenticationFilter()
    • Method Detail

      • afterPropertiesSet

        public void afterPropertiesSet()
        Specified by:
        afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
        Overrides:
        afterPropertiesSet in class org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter
      • getPreAuthenticatedPrincipal

        protected Object getPreAuthenticatedPrincipal​(javax.servlet.http.HttpServletRequest request)
        Specified by:
        getPreAuthenticatedPrincipal in class org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter
      • getPreAuthenticatedCredentials

        protected Object getPreAuthenticatedCredentials​(javax.servlet.http.HttpServletRequest request)
        Specified by:
        getPreAuthenticatedCredentials in class org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter
      • setParameterName

        public void setParameterName​(String parameterName)
        Setter for the parameter name.
        Parameters:
        parameterName - The parameter name.
      • setLoginHandler

        public void setLoginHandler​(JWTLoginHandler loginHandler)
        Setter for the login handler.
        Parameters:
        loginHandler - The login handler.
      • setExceptionIfParameterMissing

        public void setExceptionIfParameterMissing​(boolean exceptionIfParameterMissing)
        Defines whether an exception should be raised if the principal parameter is missing. Defaults to true.
        Parameters:
        exceptionIfParameterMissing - set to false to override the default behaviour and allow the request to proceed if no parameter is found.
      • setDebug

        public void setDebug​(boolean debug)
        Setter for the debug switch.
        Parameters:
        debug - Value for the debug switch.