Skip to content

Commit b60020a

Browse files
committed
Use authorizeHttpRequests in Docs
Issue gh-8900
1 parent f4ddb4e commit b60020a

File tree

14 files changed

+35
-35
lines changed

14 files changed

+35
-35
lines changed

docs/modules/ROOT/pages/servlet/authorization/authorize-requests.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ The explicit configuration looks like:
3232
protected void configure(HttpSecurity http) throws Exception {
3333
http
3434
// ...
35-
.authorizeRequests(authorize -> authorize
35+
.authorizeHttpRequests(authorize -> authorize
3636
.anyRequest().authenticated()
3737
);
3838
}
@@ -71,7 +71,7 @@ We can configure Spring Security to have different rules by adding more rules in
7171
protected void configure(HttpSecurity http) throws Exception {
7272
http
7373
// ...
74-
.authorizeRequests(authorize -> authorize // <1>
74+
.authorizeHttpRequests(authorize -> authorize // <1>
7575
.mvcMatchers("/resources/**", "/signup", "/about").permitAll() // <2>
7676
.mvcMatchers("/admin/**").hasRole("ADMIN") // <3>
7777
.mvcMatchers("/db/**").access("hasRole('ADMIN') and hasRole('DBA')") // <4>

docs/modules/ROOT/pages/servlet/authorization/expression-based.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ You could refer to the method using:
144144
[source,java,role="primary"]
145145
----
146146
http
147-
.authorizeRequests(authorize -> authorize
147+
.authorizeHttpRequests(authorize -> authorize
148148
.antMatchers("/user/**").access("@webSecurity.check(authentication,request)")
149149
...
150150
)
@@ -210,7 +210,7 @@ You could refer to the method using:
210210
[source,java,role="primary",attrs="-attributes"]
211211
----
212212
http
213-
.authorizeRequests(authorize -> authorize
213+
.authorizeHttpRequests(authorize -> authorize
214214
.antMatchers("/user/{userId}/**").access("@webSecurity.checkUserId(authentication,#userId)")
215215
...
216216
);

docs/modules/ROOT/pages/servlet/configuration/java.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public class MultiHttpSecurityConfig {
193193
protected void configure(HttpSecurity http) throws Exception {
194194
http
195195
.antMatcher("/api/**") <3>
196-
.authorizeRequests(authorize -> authorize
196+
.authorizeHttpRequests(authorize -> authorize
197197
.anyRequest().hasRole("ADMIN")
198198
)
199199
.httpBasic(withDefaults());
@@ -206,7 +206,7 @@ public class MultiHttpSecurityConfig {
206206
@Override
207207
protected void configure(HttpSecurity http) throws Exception {
208208
http
209-
.authorizeRequests(authorize -> authorize
209+
.authorizeHttpRequests(authorize -> authorize
210210
.anyRequest().authenticated()
211211
)
212212
.formLogin(withDefaults());

docs/modules/ROOT/pages/servlet/integrations/mvc.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ If we wanted to restrict access to this controller method to admin users, a deve
138138
----
139139
protected configure(HttpSecurity http) throws Exception {
140140
http
141-
.authorizeRequests(authorize -> authorize
141+
.authorizeHttpRequests(authorize -> authorize
142142
.antMatchers("/admin").hasRole("ADMIN")
143143
);
144144
}
@@ -183,7 +183,7 @@ The following configuration will protect the same URLs that Spring MVC will matc
183183
----
184184
protected configure(HttpSecurity http) throws Exception {
185185
http
186-
.authorizeRequests(authorize -> authorize
186+
.authorizeHttpRequests(authorize -> authorize
187187
.mvcMatchers("/admin").hasRole("ADMIN")
188188
);
189189
}

docs/modules/ROOT/pages/servlet/integrations/websocket.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ public class WebSecurityConfig
456456
.sameOrigin()
457457
)
458458
)
459-
.authorizeRequests(authorize -> authorize
459+
.authorizeHttpRequests(authorize -> authorize
460460
...
461461
)
462462
...

docs/modules/ROOT/pages/servlet/oauth2/client/authorization-grants.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
121121
@Override
122122
protected void configure(HttpSecurity http) throws Exception {
123123
http
124-
.authorizeRequests(authorize -> authorize
124+
.authorizeHttpRequests(authorize -> authorize
125125
.anyRequest().authenticated()
126126
)
127127
.oauth2Login(oauth2 -> oauth2

docs/modules/ROOT/pages/servlet/oauth2/login/advanced.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
872872
@Override
873873
protected void configure(HttpSecurity http) throws Exception {
874874
http
875-
.authorizeRequests(authorize -> authorize
875+
.authorizeHttpRequests(authorize -> authorize
876876
.anyRequest().authenticated()
877877
)
878878
.oauth2Login(withDefaults())

docs/modules/ROOT/pages/servlet/oauth2/login/core.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
321321
@Override
322322
protected void configure(HttpSecurity http) throws Exception {
323323
http
324-
.authorizeRequests(authorize -> authorize
324+
.authorizeHttpRequests(authorize -> authorize
325325
.anyRequest().authenticated()
326326
)
327327
.oauth2Login(withDefaults());
@@ -367,7 +367,7 @@ public class OAuth2LoginConfig {
367367
@Override
368368
protected void configure(HttpSecurity http) throws Exception {
369369
http
370-
.authorizeRequests(authorize -> authorize
370+
.authorizeHttpRequests(authorize -> authorize
371371
.anyRequest().authenticated()
372372
)
373373
.oauth2Login(withDefaults());
@@ -462,7 +462,7 @@ public class OAuth2LoginConfig {
462462
@Override
463463
protected void configure(HttpSecurity http) throws Exception {
464464
http
465-
.authorizeRequests(authorize -> authorize
465+
.authorizeHttpRequests(authorize -> authorize
466466
.anyRequest().authenticated()
467467
)
468468
.oauth2Login(withDefaults());

docs/modules/ROOT/pages/servlet/oauth2/resource-server/jwt.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ The first is a `WebSecurityConfigurerAdapter` that configures the app as a resou
146146
----
147147
protected void configure(HttpSecurity http) {
148148
http
149-
.authorizeRequests(authorize -> authorize
149+
.authorizeHttpRequests(authorize -> authorize
150150
.anyRequest().authenticated()
151151
)
152152
.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt);
@@ -182,7 +182,7 @@ Replacing this is as simple as exposing the bean within the application:
182182
public class MyCustomSecurityConfiguration extends WebSecurityConfigurerAdapter {
183183
protected void configure(HttpSecurity http) {
184184
http
185-
.authorizeRequests(authorize -> authorize
185+
.authorizeHttpRequests(authorize -> authorize
186186
.mvcMatchers("/messages/**").hasAuthority("SCOPE_message:read")
187187
.anyRequest().authenticated()
188188
)
@@ -299,7 +299,7 @@ An authorization server's JWK Set Uri can be configured <<oauth2resourceserver-j
299299
public class DirectlyConfiguredJwkSetUri extends WebSecurityConfigurerAdapter {
300300
protected void configure(HttpSecurity http) {
301301
http
302-
.authorizeRequests(authorize -> authorize
302+
.authorizeHttpRequests(authorize -> authorize
303303
.anyRequest().authenticated()
304304
)
305305
.oauth2ResourceServer(oauth2 -> oauth2
@@ -359,7 +359,7 @@ More powerful than `jwkSetUri()` is `decoder()`, which will completely replace a
359359
public class DirectlyConfiguredJwtDecoder extends WebSecurityConfigurerAdapter {
360360
protected void configure(HttpSecurity http) {
361361
http
362-
.authorizeRequests(authorize -> authorize
362+
.authorizeHttpRequests(authorize -> authorize
363363
.anyRequest().authenticated()
364364
)
365365
.oauth2ResourceServer(oauth2 -> oauth2
@@ -719,7 +719,7 @@ This means that to protect an endpoint or method with a scope derived from a JWT
719719
public class DirectlyConfiguredJwkSetUri extends WebSecurityConfigurerAdapter {
720720
protected void configure(HttpSecurity http) {
721721
http
722-
.authorizeRequests(authorize -> authorize
722+
.authorizeHttpRequests(authorize -> authorize
723723
.mvcMatchers("/contacts/**").hasAuthority("SCOPE_contacts")
724724
.mvcMatchers("/messages/**").hasAuthority("SCOPE_messages")
725725
.anyRequest().authenticated()
@@ -926,7 +926,7 @@ static class CustomAuthenticationConverter implements Converter<Jwt, AbstractAut
926926
public class CustomAuthenticationConverterConfig extends WebSecurityConfigurerAdapter {
927927
protected void configure(HttpSecurity http) {
928928
http
929-
.authorizeRequests(authorize -> authorize
929+
.authorizeHttpRequests(authorize -> authorize
930930
.anyRequest().authenticated()
931931
)
932932
.oauth2ResourceServer(oauth2 -> oauth2

docs/modules/ROOT/pages/servlet/oauth2/resource-server/multitenancy.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ And then specify this `AuthenticationManagerResolver` in the DSL:
5353
[source,java,role="primary"]
5454
----
5555
http
56-
.authorizeRequests(authorize -> authorize
56+
.authorizeHttpRequests(authorize -> authorize
5757
.anyRequest().authenticated()
5858
)
5959
.oauth2ResourceServer(oauth2 -> oauth2
@@ -109,7 +109,7 @@ JwtIssuerAuthenticationManagerResolver authenticationManagerResolver = new JwtIs
109109
("https://idp.example.org/issuerOne", "https://idp.example.org/issuerTwo");
110110
111111
http
112-
.authorizeRequests(authorize -> authorize
112+
.authorizeHttpRequests(authorize -> authorize
113113
.anyRequest().authenticated()
114114
)
115115
.oauth2ResourceServer(oauth2 -> oauth2
@@ -176,7 +176,7 @@ JwtIssuerAuthenticationManagerResolver authenticationManagerResolver =
176176
new JwtIssuerAuthenticationManagerResolver(authenticationManagers::get);
177177
178178
http
179-
.authorizeRequests(authorize -> authorize
179+
.authorizeHttpRequests(authorize -> authorize
180180
.anyRequest().authenticated()
181181
)
182182
.oauth2ResourceServer(oauth2 -> oauth2

0 commit comments

Comments
 (0)