Skip to content

Commit 681e166

Browse files
committed
Remove default HttpSecurity.securityMatcher() for authorization server
Closes gh-17965
1 parent 7f10897 commit 681e166

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

config/src/main/java/org/springframework/security/config/annotation/web/configurers/oauth2/server/authorization/OAuth2AuthorizationServerConfigurer.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,6 @@ public void init(HttpSecurity httpSecurity) {
396396
new OrRequestMatcher(preferredMatchers));
397397
}
398398

399-
httpSecurity.securityMatchers((securityMatchers) -> securityMatchers.requestMatchers(this.endpointsMatcher));
400-
401399
httpSecurity.csrf((csrf) -> csrf.ignoringRequestMatchers(this.endpointsMatcher));
402400

403401
if (getConfigurer(OAuth2ClientRegistrationEndpointConfigurer.class) != null) {

docs/modules/ROOT/pages/servlet/oauth2/authorization-server/getting-started.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,11 @@ public class SecurityConfig {
132132
133133
// @formatter:off
134134
http
135-
.oauth2AuthorizationServer((authorizationServer) ->
135+
.oauth2AuthorizationServer((authorizationServer) -> {
136+
http.securityMatcher(authorizationServer.getEndpointsMatcher());
136137
authorizationServer
137-
.oidc(Customizer.withDefaults()) // Enable OpenID Connect 1.0
138-
)
138+
.oidc(Customizer.withDefaults()); // Enable OpenID Connect 1.0
139+
})
139140
.authorizeHttpRequests((authorize) ->
140141
authorize
141142
.anyRequest().authenticated()

0 commit comments

Comments
 (0)