Skip to content

Commit 273c5d2

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

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

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

+5-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,8 @@ 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).clientSecret(this.clientSecret).build();
495496
return this;
496497
}
497498

@@ -500,8 +501,8 @@ public OpaqueTokenConfigurer introspectionClientCredentials(String clientId, Str
500501
Assert.notNull(clientSecret, "clientSecret cannot be null");
501502
this.clientId = clientId;
502503
this.clientSecret = clientSecret;
503-
this.introspector = () -> new SpringOpaqueTokenIntrospector(this.introspectionUri, this.clientId,
504-
this.clientSecret);
504+
this.introspector = () -> SpringOpaqueTokenIntrospector.withIntrospectionUri(this.introspectionUri)
505+
.clientId(this.clientId).clientSecret(this.clientSecret).build();
505506
return this;
506507
}
507508

0 commit comments

Comments
 (0)