Package org.pac4j.springframework.web
Class SecurityInterceptor
- java.lang.Object
-
- org.springframework.web.servlet.handler.HandlerInterceptorAdapter
-
- org.pac4j.springframework.web.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) andsetMultiProfile(Boolean)
(whether multiple profiles should be kept).- Since:
- 1.0.0
- Author:
- Jerome Leleu
-
-
Constructor Summary
Constructors Constructor Description SecurityInterceptor(org.pac4j.core.config.Config config)
SecurityInterceptor(org.pac4j.core.config.Config config, String clients)
SecurityInterceptor(org.pac4j.core.config.Config config, String clients, String authorizers)
SecurityInterceptor(org.pac4j.core.config.Config config, String clients, String authorizers, String matchers)
SecurityInterceptor(org.pac4j.core.config.Config config, String clients, org.pac4j.core.authorization.authorizer.Authorizer[] authorizers)
SecurityInterceptor(org.pac4j.core.config.Config config, String clients, org.pac4j.core.authorization.authorizer.Authorizer[] authorizers, org.pac4j.core.matching.Matcher[] matchers)
SecurityInterceptor(org.pac4j.core.config.Config config, String clients, org.pac4j.core.http.adapter.HttpActionAdapter httpActionAdapter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAuthorizers()
String
getClients()
org.pac4j.core.config.Config
getConfig()
org.pac4j.core.http.adapter.HttpActionAdapter
getHttpActionAdapter()
String
getMatchers()
Boolean
getMultiProfile()
org.pac4j.core.engine.SecurityLogic<Boolean,org.pac4j.core.context.JEEContext>
getSecurityLogic()
boolean
preHandle(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, Object handler)
void
setAuthorizers(String authorizers)
void
setClients(String clients)
void
setConfig(org.pac4j.core.config.Config config)
void
setHttpActionAdapter(org.pac4j.core.http.adapter.HttpActionAdapter httpActionAdapter)
void
setMatchers(String matchers)
void
setMultiProfile(Boolean multiProfile)
void
setSecurityLogic(org.pac4j.core.engine.SecurityLogic<Boolean,org.pac4j.core.context.JEEContext> securityLogic)
-
-
-
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 interfaceorg.springframework.web.servlet.HandlerInterceptor
- Overrides:
preHandle
in classorg.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)
-
-