Skip to content

Commit 118bc57

Browse files
committed
Improve OAuth2ResourceServerConfigurer to eliminate deprecated operations
Signed-off-by: Yanming Zhou <[email protected]>
1 parent 39b195c commit 118bc57

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/resource/OAuth2ResourceServerConfigurer.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
* @author Josh Cummings
139139
* @author Evgeniy Cheban
140140
* @author Jerome Wacongne &lt;[email protected]&gt;
141+
* @author Yanming Zhou
141142
* @since 5.1
142143
* @see BearerTokenAuthenticationFilter
143144
* @see JwtAuthenticationProvider
@@ -490,8 +491,10 @@ public OpaqueTokenConfigurer authenticationManager(AuthenticationManager authent
490491
public OpaqueTokenConfigurer introspectionUri(String introspectionUri) {
491492
Assert.notNull(introspectionUri, "introspectionUri cannot be null");
492493
this.introspectionUri = introspectionUri;
493-
this.introspector = () -> new SpringOpaqueTokenIntrospector(this.introspectionUri, this.clientId,
494-
this.clientSecret);
494+
this.introspector = () -> SpringOpaqueTokenIntrospector.withIntrospectionUri(this.introspectionUri)
495+
.clientId(this.clientId)
496+
.clientSecret(this.clientSecret)
497+
.build();
495498
return this;
496499
}
497500

@@ -500,8 +503,10 @@ public OpaqueTokenConfigurer introspectionClientCredentials(String clientId, Str
500503
Assert.notNull(clientSecret, "clientSecret cannot be null");
501504
this.clientId = clientId;
502505
this.clientSecret = clientSecret;
503-
this.introspector = () -> new SpringOpaqueTokenIntrospector(this.introspectionUri, this.clientId,
504-
this.clientSecret);
506+
this.introspector = () -> SpringOpaqueTokenIntrospector.withIntrospectionUri(this.introspectionUri)
507+
.clientId(this.clientId)
508+
.clientSecret(this.clientSecret)
509+
.build();
505510
return this;
506511
}
507512

0 commit comments

Comments
 (0)