Package xyz.zeroonebn.security
Class CustomRequestCache
- java.lang.Object
-
- org.springframework.security.web.savedrequest.HttpSessionRequestCache
-
- xyz.zeroonebn.security.CustomRequestCache
-
- All Implemented Interfaces:
org.springframework.security.web.savedrequest.RequestCache
public class CustomRequestCache extends org.springframework.security.web.savedrequest.HttpSessionRequestCacheHttpSessionRequestCache that avoids saving internal framework requests.
-
-
Constructor Summary
Constructors Constructor Description CustomRequestCache(SecurityProperties securityProperties, SecurityUtils securityUtils)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringresolveRedirectUrl()Unfortunately, it's not that easy to resolve the redirect URL from the saved request.voidsaveRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
-
-
-
Constructor Detail
-
CustomRequestCache
public CustomRequestCache(SecurityProperties securityProperties, SecurityUtils securityUtils)
-
-
Method Detail
-
saveRequest
public void saveRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)If the method is considered an internal request from the framework, we skip saving it.
- Specified by:
saveRequestin interfaceorg.springframework.security.web.savedrequest.RequestCache- Overrides:
saveRequestin classorg.springframework.security.web.savedrequest.HttpSessionRequestCache- See Also:
SecurityUtils.isFrameworkInternalRequest(HttpServletRequest)
-
resolveRedirectUrl
public java.lang.String resolveRedirectUrl()
Unfortunately, it's not that easy to resolve the redirect URL from the saved request. But with some casting (we always useDefaultSavedRequest) and mangling we are able to get the request URI.
-
-