mirror of
				https://github.com/spring-projects/spring-security.git
				synced 2025-11-04 00:28:54 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			50 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			50 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
.`RequestCache` Only Checks for Saved Requests if `continue` Parameter Present
 | 
						|
[tabs]
 | 
						|
======
 | 
						|
Java::
 | 
						|
+
 | 
						|
[source,java,role="primary"]
 | 
						|
----
 | 
						|
@Bean
 | 
						|
DefaultSecurityFilterChain springSecurity(HttpSecurity http) throws Exception {
 | 
						|
	HttpSessionRequestCache requestCache = new HttpSessionRequestCache();
 | 
						|
	requestCache.setMatchingRequestParameterName("continue");
 | 
						|
	http
 | 
						|
		// ...
 | 
						|
		.requestCache((cache) -> cache
 | 
						|
			.requestCache(requestCache)
 | 
						|
		);
 | 
						|
	return http.build();
 | 
						|
}
 | 
						|
----
 | 
						|
 | 
						|
Kotlin::
 | 
						|
+
 | 
						|
[source,kotlin,role="secondary"]
 | 
						|
----
 | 
						|
@Bean
 | 
						|
open fun springSecurity(http: HttpSecurity): SecurityFilterChain {
 | 
						|
    val httpRequestCache = HttpSessionRequestCache()
 | 
						|
    httpRequestCache.setMatchingRequestParameterName("continue")
 | 
						|
    http {
 | 
						|
        requestCache {
 | 
						|
            requestCache = httpRequestCache
 | 
						|
        }
 | 
						|
    }
 | 
						|
    return http.build()
 | 
						|
}
 | 
						|
----
 | 
						|
 | 
						|
XML::
 | 
						|
+
 | 
						|
[source,xml,role="secondary"]
 | 
						|
----
 | 
						|
<http auto-config="true">
 | 
						|
	<!-- ... -->
 | 
						|
	<request-cache ref="requestCache"/>
 | 
						|
</http>
 | 
						|
 | 
						|
<b:bean id="requestCache" class="org.springframework.security.web.savedrequest.HttpSessionRequestCache"
 | 
						|
	p:matchingRequestParameterName="continue"/>
 | 
						|
----
 | 
						|
====== |