2
0

request-cache-continue.adoc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. .`RequestCache` Only Checks for Saved Requests if `continue` Parameter Present
  2. ====
  3. .Java
  4. [source,java,role="primary"]
  5. ----
  6. @Bean
  7. DefaultSecurityFilterChain springSecurity(HttpSecurity http) throws Exception {
  8. HttpSessionRequestCache requestCache = new HttpSessionRequestCache();
  9. requestCache.setMatchingRequestParameterName("continue");
  10. http
  11. // ...
  12. .requestCache((cache) -> cache
  13. .requestCache(requestCache)
  14. );
  15. return http.build();
  16. }
  17. ----
  18. .Kotlin
  19. [source,kotlin,role="secondary"]
  20. ----
  21. @EnableWebSecurity
  22. class SecurityConfig {
  23. @Bean
  24. open fun springSecurity(http: HttpSecurity): SecurityFilterChain {
  25. val httpRequestCache = HttpSessionRequestCache()
  26. httpRequestCache.setMatchingRequestParameterName("continue")
  27. http {
  28. requestCache {
  29. requestCache = httpRequestCache
  30. }
  31. }
  32. return http.build()
  33. }
  34. }
  35. ----
  36. .XML
  37. [source,xml,role="secondary"]
  38. ----
  39. <http auto-config="true">
  40. <!-- ... -->
  41. <request-cache ref="requestCache"/>
  42. </http>
  43. <b:bean id="requestCache" class="org.springframework.security.web.savedrequest.HttpSessionRequestCache"
  44. p:matchingRequestParameterName="continue"/>
  45. ----
  46. ====