spring-security icon indicating copy to clipboard operation
spring-security copied to clipboard

Ignored requestCache.saveRequest, because sendRedirect is in front

Open o1i0 opened this issue 3 years ago • 2 comments

Describe the bug I am using CookieRequestCache . However, as SendRedirect proceeds first, cookie settings are not included.

To Reproduce

Expected behavior

Sample

https://github.com/spring-projects/spring-security/blob/bf138c5154e87b55ab6f1c8940116351d6e1aedc/oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationRequestRedirectFilter.java#L189-L190

o1i0 avatar Jul 20 '22 16:07 o1i0

@o1i0, thanks for the report. In your PR, will you please include a unit test that behaves the way you are expecting? It should fail without your change and pass with it.

Including a unit test will give me a better idea of your use case to see if there is a better way to address it.

jzheaux avatar Jul 20 '22 22:07 jzheaux

@jzheaux, Thanks for the quick check.

Added a test case where the response should be requestCache.saveRequest before isCommitted. https://github.com/spring-projects/spring-security/pull/11603/files#diff-09f439ada4e90ffa29137b421089e9fcf474193dcef6fb5ee15e78e5c2ed2e20R195-R196

Please check.

o1i0 avatar Jul 21 '22 04:07 o1i0