@@ -30,9 +30,11 @@ import org.springframework.security.authentication.ReactiveAuthenticationManager
30
30
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity
31
31
import org.springframework.security.config.test.SpringTestContext
32
32
import org.springframework.security.config.test.SpringTestContextExtension
33
+ import org.springframework.security.core.AuthenticationException
33
34
import org.springframework.security.oauth2.server.resource.authentication.JwtIssuerReactiveAuthenticationManagerResolver
34
35
import org.springframework.security.oauth2.server.resource.web.server.authentication.ServerBearerTokenAuthenticationConverter
35
36
import org.springframework.security.web.server.SecurityWebFilterChain
37
+ import org.springframework.security.web.server.WebFilterExchange
36
38
import org.springframework.security.web.server.authentication.HttpStatusServerEntryPoint
37
39
import org.springframework.security.web.server.authentication.ServerAuthenticationFailureHandler
38
40
import org.springframework.security.web.server.authorization.HttpStatusServerAccessDeniedHandler
@@ -152,7 +154,7 @@ class ServerOAuth2ResourceServerDslTests {
152
154
open class AuthenticationFailureHandlerConfig {
153
155
154
156
companion object {
155
- val FAILURE_HANDLER : ServerAuthenticationFailureHandler = ServerAuthenticationFailureHandler { _, _ -> Mono .empty() }
157
+ val FAILURE_HANDLER : ServerAuthenticationFailureHandler = MockServerAuthenticationFailureHandler ()
156
158
}
157
159
158
160
@Bean
@@ -171,6 +173,16 @@ class ServerOAuth2ResourceServerDslTests {
171
173
}
172
174
}
173
175
176
+ open class MockServerAuthenticationFailureHandler : ServerAuthenticationFailureHandler {
177
+ override fun onAuthenticationFailure (
178
+ webFilterExchange : WebFilterExchange ? ,
179
+ exception : AuthenticationException ?
180
+ ): Mono <Void > {
181
+ return Mono .empty()
182
+ }
183
+
184
+ }
185
+
174
186
@Test
175
187
fun `request when custom bearer token converter configured then custom converter used` () {
176
188
this .spring.register(BearerTokenConverterConfig ::class .java).autowire()
0 commit comments