Skip to content

Commit 108e646

Browse files
committed
Remove OAuth2AuthorizationServerConfiguration.applyDefaultSecurity()
Closes gh-2101
1 parent c53a092 commit 108e646

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/config/annotation/web/configuration/OAuth2AuthorizationServerConfiguration.java

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2024 the original author or authors.
2+
* Copyright 2020-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -31,7 +31,6 @@
3131
import org.springframework.core.Ordered;
3232
import org.springframework.core.annotation.Order;
3333
import org.springframework.security.config.Customizer;
34-
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
3534
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
3635
import org.springframework.security.oauth2.jwt.JwtDecoder;
3736
import org.springframework.security.oauth2.jwt.NimbusJwtDecoder;
@@ -65,28 +64,6 @@ public SecurityFilterChain authorizationServerSecurityFilterChain(HttpSecurity h
6564
return http.build();
6665
}
6766

68-
/**
69-
* @param http the {@link HttpSecurity}
70-
* @throws Exception if {@link OAuth2AuthorizationServerConfigurer} could not be
71-
* applied
72-
* @deprecated For removal in 2.0. Use
73-
* {@link HttpSecurity#with(SecurityConfigurerAdapter, Customizer)} and pass in
74-
* {@link OAuth2AuthorizationServerConfigurer#authorizationServer()}.
75-
*/
76-
@Deprecated(since = "1.4", forRemoval = true)
77-
public static void applyDefaultSecurity(HttpSecurity http) throws Exception {
78-
// @formatter:off
79-
OAuth2AuthorizationServerConfigurer authorizationServerConfigurer =
80-
OAuth2AuthorizationServerConfigurer.authorizationServer();
81-
http
82-
.securityMatcher(authorizationServerConfigurer.getEndpointsMatcher())
83-
.with(authorizationServerConfigurer, Customizer.withDefaults())
84-
.authorizeHttpRequests((authorize) ->
85-
authorize.anyRequest().authenticated()
86-
);
87-
// @formatter:on
88-
}
89-
9067
public static JwtDecoder jwtDecoder(JWKSource<SecurityContext> jwkSource) {
9168
Set<JWSAlgorithm> jwsAlgs = new HashSet<>();
9269
jwsAlgs.addAll(JWSAlgorithm.Family.RSA);

0 commit comments

Comments
 (0)