parent
22cbd2c42e
commit
6bbf20be93
|
@ -19,6 +19,8 @@ package org.springframework.security.config.annotation.web
|
||||||
import io.mockk.every
|
import io.mockk.every
|
||||||
import io.mockk.mockkObject
|
import io.mockk.mockkObject
|
||||||
import io.mockk.verify
|
import io.mockk.verify
|
||||||
|
import jakarta.servlet.http.HttpServletRequest
|
||||||
|
import jakarta.servlet.http.HttpServletResponse
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.api.extension.ExtendWith
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
|
@ -37,17 +39,17 @@ import org.springframework.security.web.SecurityFilterChain
|
||||||
import org.springframework.security.web.authentication.session.NullAuthenticatedSessionStrategy
|
import org.springframework.security.web.authentication.session.NullAuthenticatedSessionStrategy
|
||||||
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy
|
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy
|
||||||
import org.springframework.security.web.csrf.CsrfTokenRepository
|
import org.springframework.security.web.csrf.CsrfTokenRepository
|
||||||
|
import org.springframework.security.web.csrf.CsrfTokenRequestAttributeHandler
|
||||||
import org.springframework.security.web.csrf.CsrfTokenRequestHandler
|
import org.springframework.security.web.csrf.CsrfTokenRequestHandler
|
||||||
import org.springframework.security.web.csrf.DefaultCsrfToken
|
import org.springframework.security.web.csrf.DefaultCsrfToken
|
||||||
import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository
|
import org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository
|
||||||
import org.springframework.security.web.util.matcher.AntPathRequestMatcher
|
import org.springframework.security.web.util.matcher.AntPathRequestMatcher
|
||||||
import org.springframework.test.web.servlet.MockMvc
|
import org.springframework.test.web.servlet.MockMvc
|
||||||
|
import org.springframework.test.web.servlet.get
|
||||||
import org.springframework.test.web.servlet.post
|
import org.springframework.test.web.servlet.post
|
||||||
import org.springframework.web.bind.annotation.PostMapping
|
import org.springframework.web.bind.annotation.PostMapping
|
||||||
import org.springframework.web.bind.annotation.RestController
|
import org.springframework.web.bind.annotation.RestController
|
||||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc
|
||||||
import javax.servlet.http.HttpServletRequest
|
|
||||||
import javax.servlet.http.HttpServletResponse
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for [CsrfDsl]
|
* Tests for [CsrfDsl]
|
||||||
|
@ -360,9 +362,7 @@ class CsrfDslTests {
|
||||||
open class RequestHandlerConfig {
|
open class RequestHandlerConfig {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val HANDLER: CsrfTokenRequestHandler = CsrfTokenRequestHandler { request, response, _ ->
|
var HANDLER: CsrfTokenRequestHandler = CsrfTokenRequestAttributeHandler()
|
||||||
request.setAttribute(HttpServletResponse::class.java.name, response)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
Loading…
Reference in New Issue