Class VerifyRedirectCookieFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
com.broadleafcommerce.auth.user.session.VerifyRedirectCookieFilter
- 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.EnvironmentAware
,org.springframework.core.env.EnvironmentCapable
,org.springframework.web.context.ServletContextAware
public class VerifyRedirectCookieFilter
extends org.springframework.web.filter.GenericFilterBean
This filter is for verifying that there's a saved redirect cookie on the request for certain
URIs. If no saved redirect cookie exists for a request that requires one then the user is
redirected to a default URI.
- Author:
- Jay Aisenbrey (cja769)
-
Field Summary
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger
-
Constructor Summary
ConstructorDescriptionVerifyRedirectCookieFilter
(StatelessUtil statelessUtil, ClientRedirectService redirectService, VerifyRedirectCookieProperties properties) VerifyRedirectCookieFilter
(StatelessUtil statelessUtil, org.springframework.security.web.util.matcher.RequestMatcher requestMatcher, ClientRedirectService redirectService, VerifyRedirectCookieProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionvoid
doFilter
(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) protected String
getDefaultRedirect
(javax.servlet.ServletRequest request) Gets the default redirect that the user should be redirected to since the request required a redirect cookie and didn't have one.protected VerifyRedirectCookieProperties
protected ClientRedirectService
protected org.springframework.security.web.util.matcher.RequestMatcher
protected StatelessUtil
protected boolean
shouldVerifyRedirect
(javax.servlet.http.HttpServletRequest request) Specifies if the redirect cookie should be verified for the given requestMethods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
-
Constructor Details
-
VerifyRedirectCookieFilter
public VerifyRedirectCookieFilter(StatelessUtil statelessUtil, ClientRedirectService redirectService, VerifyRedirectCookieProperties properties) -
VerifyRedirectCookieFilter
public VerifyRedirectCookieFilter(StatelessUtil statelessUtil, org.springframework.security.web.util.matcher.RequestMatcher requestMatcher, ClientRedirectService redirectService, VerifyRedirectCookieProperties properties)
-
-
Method Details
-
doFilter
public void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain) throws IOException, javax.servlet.ServletException - Throws:
IOException
javax.servlet.ServletException
-
shouldVerifyRedirect
protected boolean shouldVerifyRedirect(javax.servlet.http.HttpServletRequest request) Specifies if the redirect cookie should be verified for the given request- Parameters:
request
- the request to be verified against- Returns:
- true if verification on if a redirect cookie exists on a request is needed else false
-
getDefaultRedirect
Gets the default redirect that the user should be redirected to since the request required a redirect cookie and didn't have one. By default the URI is pulled in this order 1.AuthorizedClient.getDefaultRedirectUri()
2.AuthorizationServer.getDefaultRedirectUri()
3.VerifyRedirectCookieProperties.getDefaultRedirectUrl()
- Parameters:
request
- the request to use for finding the default redirect URI- Returns:
- default redirect URI for the request.
-
getStatelessUtil
-
getRequestMatcher
protected org.springframework.security.web.util.matcher.RequestMatcher getRequestMatcher() -
getRedirectService
-
getProperties
-