request-cache-continue.adoc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. @Bean
  22. open fun springSecurity(http: HttpSecurity): SecurityFilterChain {
  23. val httpRequestCache = HttpSessionRequestCache()
  24. httpRequestCache.setMatchingRequestParameterName("continue")
  25. http {
  26. requestCache {
  27. requestCache = httpRequestCache
  28. }
  29. }
  30. return http.build()
  31. }
  32. ----
  33. .XML
  34. [source,xml,role="secondary"]
  35. ----
  36. <http auto-config="true">
  37. <!-- ... -->
  38. <request-cache ref="requestCache"/>
  39. </http>
  40. <b:bean id="requestCache" class="org.springframework.security.web.savedrequest.HttpSessionRequestCache"
  41. p:matchingRequestParameterName="continue"/>
  42. ----
  43. ====