Class SecurityInterceptor

  • All Implemented Interfaces:
    org.springframework.web.servlet.AsyncHandlerInterceptor, org.springframework.web.servlet.HandlerInterceptor

    public class SecurityInterceptor
    extends org.springframework.web.servlet.handler.HandlerInterceptorAdapter

    This interceptor protects an url, based on the securityLogic.

    The configuration can be provided via contructors or setter methods: setConfig(Config) (the security configuration), setClients(String) (list of clients for authentication), setAuthorizers(String) (list of authorizers), setMatchers(String) (list of matchers) and setMultiProfile(Boolean) (whether multiple profiles should be kept).

    Since:
    1.0.0
    Author:
    Jerome Leleu
    • Constructor Detail

      • SecurityInterceptor

        public SecurityInterceptor​(org.pac4j.core.config.Config config)
      • SecurityInterceptor

        public SecurityInterceptor​(org.pac4j.core.config.Config config,
                                   String clients)
      • SecurityInterceptor

        public SecurityInterceptor​(org.pac4j.core.config.Config config,
                                   String clients,
                                   org.pac4j.core.http.adapter.HttpActionAdapter httpActionAdapter)
      • SecurityInterceptor

        public SecurityInterceptor​(org.pac4j.core.config.Config config,
                                   String clients,
                                   String authorizers)
      • SecurityInterceptor

        public SecurityInterceptor​(org.pac4j.core.config.Config config,
                                   String clients,
                                   org.pac4j.core.authorization.authorizer.Authorizer[] authorizers)
      • SecurityInterceptor

        public SecurityInterceptor​(org.pac4j.core.config.Config config,
                                   String clients,
                                   String authorizers,
                                   String matchers)
      • SecurityInterceptor

        public SecurityInterceptor​(org.pac4j.core.config.Config config,
                                   String clients,
                                   org.pac4j.core.authorization.authorizer.Authorizer[] authorizers,
                                   org.pac4j.core.matching.Matcher[] matchers)
    • Method Detail

      • preHandle

        public boolean preHandle​(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 Object handler)
                          throws Exception
        Specified by:
        preHandle in interface org.springframework.web.servlet.HandlerInterceptor
        Overrides:
        preHandle in class org.springframework.web.servlet.handler.HandlerInterceptorAdapter
        Throws:
        Exception
      • getSecurityLogic

        public org.pac4j.core.engine.SecurityLogic<Boolean,​org.pac4j.core.context.JEEContext> getSecurityLogic()
      • setSecurityLogic

        public void setSecurityLogic​(org.pac4j.core.engine.SecurityLogic<Boolean,​org.pac4j.core.context.JEEContext> securityLogic)
      • getClients

        public String getClients()
      • setClients

        public void setClients​(String clients)
      • getAuthorizers

        public String getAuthorizers()
      • setAuthorizers

        public void setAuthorizers​(String authorizers)
      • getMatchers

        public String getMatchers()
      • setMatchers

        public void setMatchers​(String matchers)
      • getMultiProfile

        public Boolean getMultiProfile()
      • setMultiProfile

        public void setMultiProfile​(Boolean multiProfile)
      • getConfig

        public org.pac4j.core.config.Config getConfig()
      • setConfig

        public void setConfig​(org.pac4j.core.config.Config config)
      • getHttpActionAdapter

        public org.pac4j.core.http.adapter.HttpActionAdapter getHttpActionAdapter()
      • setHttpActionAdapter

        public void setHttpActionAdapter​(org.pac4j.core.http.adapter.HttpActionAdapter httpActionAdapter)