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)
-
-
Constructor Summary
Constructors Constructor Description VerifyRedirectCookieFilter(StatelessUtil statelessUtil, ClientRedirectService redirectService, VerifyRedirectCookieProperties properties)
VerifyRedirectCookieFilter(StatelessUtil statelessUtil, org.springframework.security.web.util.matcher.RequestMatcher requestMatcher, ClientRedirectService redirectService, VerifyRedirectCookieProperties properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
getProperties()
protected ClientRedirectService
getRedirectService()
protected org.springframework.security.web.util.matcher.RequestMatcher
getRequestMatcher()
protected StatelessUtil
getStatelessUtil()
protected boolean
shouldVerifyRedirect(javax.servlet.http.HttpServletRequest request)
Specifies if the redirect cookie should be verified for the given request
-
-
-
Constructor Detail
-
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 Detail
-
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
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. 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
protected StatelessUtil getStatelessUtil()
-
getRequestMatcher
protected org.springframework.security.web.util.matcher.RequestMatcher getRequestMatcher()
-
getRedirectService
protected ClientRedirectService getRedirectService()
-
getProperties
protected VerifyRedirectCookieProperties getProperties()
-
-