@@ -24,6 +24,7 @@ import org.junit.jupiter.api.extension.ExtendWith
2424import org.springframework.beans.factory.annotation.Autowired
2525import org.springframework.context.annotation.Bean
2626import org.springframework.context.annotation.Configuration
27+ import org.springframework.core.ParameterizedTypeReference
2728import org.springframework.http.HttpHeaders
2829import org.springframework.http.HttpStatus
2930import org.springframework.http.MediaType
@@ -41,7 +42,6 @@ import org.springframework.security.oauth2.core.DefaultOAuth2AuthenticatedPrinci
4142import org.springframework.security.oauth2.core.TestOAuth2AccessTokens
4243import org.springframework.security.oauth2.jwt.JwtClaimNames
4344import org.springframework.security.oauth2.server.resource.authentication.BearerTokenAuthentication
44- import org.springframework.security.oauth2.server.resource.introspection.NimbusOpaqueTokenIntrospector
4545import org.springframework.security.oauth2.server.resource.introspection.OpaqueTokenIntrospector
4646import org.springframework.security.oauth2.server.resource.introspection.SpringOpaqueTokenIntrospector
4747import org.springframework.security.web.SecurityFilterChain
@@ -84,14 +84,16 @@ class OpaqueTokenDslTests {
8484 val headers = HttpHeaders ().apply {
8585 contentType = MediaType .APPLICATION_JSON
8686 }
87- val entity = ResponseEntity (" {\n " +
88- " \" active\" : true,\n " +
89- " \" sub\" : \" test-subject\" ,\n " +
90- " \" scope\" : \" message:read\" ,\n " +
91- " \" exp\" : 4683883211\n " +
92- " }" , headers, HttpStatus .OK )
87+ val entity = ResponseEntity (
88+ mapOf<String , Any >(
89+ " active" to true ,
90+ " sub" to " test-subject" ,
91+ " scope" to " message:read" ,
92+ " exp" to 4683883211
93+ ), headers, HttpStatus .OK
94+ )
9395 every {
94- DefaultOpaqueConfig .REST .exchange(any(), eq( String ::class .java ))
96+ DefaultOpaqueConfig .REST .exchange(any(), any( ParameterizedTypeReference ::class ))
9597 } returns entity
9698
9799 this .mockMvc.get(" /authenticated" ) {
@@ -127,8 +129,8 @@ class OpaqueTokenDslTests {
127129 open fun rest (): RestOperations = REST
128130
129131 @Bean
130- open fun tokenIntrospectionClient (): NimbusOpaqueTokenIntrospector {
131- return NimbusOpaqueTokenIntrospector (" https://example.org/introspect" , REST )
132+ open fun tokenIntrospectionClient (): SpringOpaqueTokenIntrospector {
133+ return SpringOpaqueTokenIntrospector (" https://example.org/introspect" , REST )
132134 }
133135 }
134136
0 commit comments