Class CasGatewayAuthenticationRedirectFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.security.cas.web.CasGatewayAuthenticationRedirectFilter
- All Implemented Interfaces:
jakarta.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.EnvironmentAware
,org.springframework.core.env.EnvironmentCapable
,org.springframework.web.context.ServletContextAware
public final class CasGatewayAuthenticationRedirectFilter
extends org.springframework.web.filter.GenericFilterBean
Redirects the request to the CAS server appending
gateway=true
to the URL. Upon
redirection, the ServiceProperties.isSendRenew()
is ignored and considered as
false
to align with the specification says that the sendRenew
parameter
is not compatible with the gateway
parameter. See the CAS
Protocol Specification for more details. To allow other filters to know if the
request is a gateway request, this filter creates a session and add an attribute with
name CAS_GATEWAY_AUTHENTICATION_ATTR
which can be checked by other filters if
needed. It is recommended that this filter is placed after
CasAuthenticationFilter
if it is defined.- Since:
- 6.3
-
Field Summary
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger
-
Constructor Summary
ConstructorDescriptionCasGatewayAuthenticationRedirectFilter
(String casLoginUrl, ServiceProperties serviceProperties) Constructs a new instance of this class -
Method Summary
Modifier and TypeMethodDescriptionvoid
doFilter
(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res, jakarta.servlet.FilterChain chain) void
setRequestCache
(RequestCache requestCache) Sets theRequestCache
used to store the current request to be replayed after redirect from the CAS server.void
setRequestMatcher
(RequestMatcher requestMatcher) Sets theRequestMatcher
used to trigger this filter.Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
-
Field Details
-
CAS_GATEWAY_AUTHENTICATION_ATTR
- See Also:
-
-
Constructor Details
-
CasGatewayAuthenticationRedirectFilter
public CasGatewayAuthenticationRedirectFilter(String casLoginUrl, ServiceProperties serviceProperties) Constructs a new instance of this class- Parameters:
serviceProperties
- theServiceProperties
-
-
Method Details
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Throws:
IOException
jakarta.servlet.ServletException
-
setRequestMatcher
Sets theRequestMatcher
used to trigger this filter. Defaults toCasGatewayResolverRequestMatcher
.- Parameters:
requestMatcher
- theRequestMatcher
to use
-
setRequestCache
Sets theRequestCache
used to store the current request to be replayed after redirect from the CAS server. Defaults toHttpSessionRequestCache
.- Parameters:
requestCache
- theRequestCache
to use
-