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
FieldsFields inherited from class org.springframework.web.filter.GenericFilterBean
logger -
Constructor Summary
ConstructorsConstructorDescriptionCasGatewayAuthenticationRedirectFilter(String casLoginUrl, ServiceProperties serviceProperties) Constructs a new instance of this class -
Method Summary
Modifier and TypeMethodDescriptionvoiddoFilter(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res, jakarta.servlet.FilterChain chain) voidsetRequestCache(RequestCache requestCache) Sets theRequestCacheused to store the current request to be replayed after redirect from the CAS server.voidsetRequestMatcher(RequestMatcher requestMatcher) Sets theRequestMatcherused 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:
IOExceptionjakarta.servlet.ServletException
-
setRequestMatcher
Sets theRequestMatcherused to trigger this filter. Defaults toCasGatewayResolverRequestMatcher.- Parameters:
requestMatcher- theRequestMatcherto use
-
setRequestCache
Sets theRequestCacheused to store the current request to be replayed after redirect from the CAS server. Defaults toHttpSessionRequestCache.- Parameters:
requestCache- theRequestCacheto use
-