@@ -16,15 +16,25 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
16
16
@Override
17
17
protected void configure(HttpSecurity http) throws Exception {
18
18
http
19
- .oauth2Login()
20
- .authorizationEndpoint()
21
- ...
22
- .redirectionEndpoint()
23
- ...
24
- .tokenEndpoint()
25
- ...
26
- .userInfoEndpoint()
27
- ...
19
+ .oauth2Login(oauth2Login ->
20
+ oauth2Login
21
+ .authorizationEndpoint(authorizationEndpoint ->
22
+ authorizationEndpoint
23
+ ...
24
+ )
25
+ .redirectionEndpoint(redirectionEndpoint ->
26
+ redirectionEndpoint
27
+ ...
28
+ )
29
+ .tokenEndpoint(tokenEndpoint ->
30
+ tokenEndpoint
31
+ ...
32
+ )
33
+ .userInfoEndpoint(userInfoEndpoint ->
34
+ userInfoEndpoint
35
+ ...
36
+ )
37
+ );
28
38
}
29
39
}
30
40
----
@@ -58,27 +68,34 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
58
68
@Override
59
69
protected void configure(HttpSecurity http) throws Exception {
60
70
http
61
- .oauth2Login()
62
- .clientRegistrationRepository(this.clientRegistrationRepository())
63
- .authorizedClientRepository(this.authorizedClientRepository())
64
- .authorizedClientService(this.authorizedClientService())
65
- .loginPage("/login")
66
- .authorizationEndpoint()
67
- .baseUri(this.authorizationRequestBaseUri())
68
- .authorizationRequestRepository(this.authorizationRequestRepository())
69
- .authorizationRequestResolver(this.authorizationRequestResolver())
70
- .and()
71
- .redirectionEndpoint()
72
- .baseUri(this.authorizationResponseBaseUri())
73
- .and()
74
- .tokenEndpoint()
75
- .accessTokenResponseClient(this.accessTokenResponseClient())
76
- .and()
77
- .userInfoEndpoint()
78
- .userAuthoritiesMapper(this.userAuthoritiesMapper())
79
- .userService(this.oauth2UserService())
80
- .oidcUserService(this.oidcUserService())
81
- .customUserType(GitHubOAuth2User.class, "github");
71
+ .oauth2Login(oauth2Login ->
72
+ oauth2Login
73
+ .clientRegistrationRepository(this.clientRegistrationRepository())
74
+ .authorizedClientRepository(this.authorizedClientRepository())
75
+ .authorizedClientService(this.authorizedClientService())
76
+ .loginPage("/login")
77
+ .authorizationEndpoint(authorizationEndpoint ->
78
+ authorizationEndpoint
79
+ .baseUri(this.authorizationRequestBaseUri())
80
+ .authorizationRequestRepository(this.authorizationRequestRepository())
81
+ .authorizationRequestResolver(this.authorizationRequestResolver())
82
+ )
83
+ .redirectionEndpoint(redirectionEndpoint ->
84
+ redirectionEndpoint
85
+ .baseUri(this.authorizationResponseBaseUri())
86
+ )
87
+ .tokenEndpoint(tokenEndpoint ->
88
+ tokenEndpoint
89
+ .accessTokenResponseClient(this.accessTokenResponseClient())
90
+ )
91
+ .userInfoEndpoint(userInfoEndpoint ->
92
+ userInfoEndpoint
93
+ .userAuthoritiesMapper(this.userAuthoritiesMapper())
94
+ .userService(this.oauth2UserService())
95
+ .oidcUserService(this.oidcUserService())
96
+ .customUserType(GitHubOAuth2User.class, "github")
97
+ )
98
+ );
82
99
}
83
100
}
84
101
----
@@ -123,12 +140,16 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
123
140
@Override
124
141
protected void configure(HttpSecurity http) throws Exception {
125
142
http
126
- .oauth2Login()
127
- .loginPage("/login/oauth2")
128
- ...
129
- .authorizationEndpoint()
130
- .baseUri("/login/oauth2/authorization")
131
- ....
143
+ .oauth2Login(oauth2Login ->
144
+ oauth2Login
145
+ .loginPage("/login/oauth2")
146
+ ...
147
+ .authorizationEndpoint(authorizationEndpoint ->
148
+ authorizationEndpoint
149
+ .baseUri("/login/oauth2/authorization")
150
+ ...
151
+ )
152
+ );
132
153
}
133
154
}
134
155
----
@@ -171,10 +192,14 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
171
192
@Override
172
193
protected void configure(HttpSecurity http) throws Exception {
173
194
http
174
- .oauth2Login()
175
- .redirectionEndpoint()
176
- .baseUri("/login/oauth2/callback/*")
177
- ....
195
+ .oauth2Login(oauth2Login ->
196
+ oauth2Login
197
+ .redirectionEndpoint(redirectionEndpoint ->
198
+ redirectionEndpoint
199
+ .baseUri("/login/oauth2/callback/*")
200
+ ...
201
+ )
202
+ );
178
203
}
179
204
}
180
205
----
@@ -234,10 +259,14 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
234
259
@Override
235
260
protected void configure(HttpSecurity http) throws Exception {
236
261
http
237
- .oauth2Login()
238
- .userInfoEndpoint()
239
- .userAuthoritiesMapper(this.userAuthoritiesMapper())
240
- ...
262
+ .oauth2Login(oauth2Login ->
263
+ oauth2Login
264
+ .userInfoEndpoint(userInfoEndpoint ->
265
+ userInfoEndpoint
266
+ .userAuthoritiesMapper(this.userAuthoritiesMapper())
267
+ ...
268
+ )
269
+ );
241
270
}
242
271
243
272
private GrantedAuthoritiesMapper userAuthoritiesMapper() {
@@ -280,7 +309,8 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
280
309
281
310
@Override
282
311
protected void configure(HttpSecurity http) throws Exception {
283
- http.oauth2Login();
312
+ http
313
+ .oauth2Login(withDefaults());
284
314
}
285
315
286
316
@Bean
@@ -308,10 +338,14 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
308
338
@Override
309
339
protected void configure(HttpSecurity http) throws Exception {
310
340
http
311
- .oauth2Login()
312
- .userInfoEndpoint()
313
- .oidcUserService(this.oidcUserService())
314
- ...
341
+ .oauth2Login(oauth2Login ->
342
+ oauth2Login
343
+ .userInfoEndpoint(userInfoEndpoint ->
344
+ userInfoEndpoint
345
+ .oidcUserService(this.oidcUserService())
346
+ ...
347
+ )
348
+ );
315
349
}
316
350
317
351
private OAuth2UserService<OidcUserRequest, OidcUser> oidcUserService() {
@@ -355,10 +389,14 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
355
389
@Override
356
390
protected void configure(HttpSecurity http) throws Exception {
357
391
http
358
- .oauth2Login()
359
- .userInfoEndpoint()
360
- .customUserType(GitHubOAuth2User.class, "github")
361
- ...
392
+ .oauth2Login(oauth2Login ->
393
+ oauth2Login
394
+ .userInfoEndpoint(userInfoEndpoint ->
395
+ userInfoEndpoint
396
+ .customUserType(GitHubOAuth2User.class, "github")
397
+ ...
398
+ )
399
+ );
362
400
}
363
401
}
364
402
----
@@ -469,10 +507,14 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
469
507
@Override
470
508
protected void configure(HttpSecurity http) throws Exception {
471
509
http
472
- .oauth2Login()
473
- .userInfoEndpoint()
474
- .userService(this.oauth2UserService())
475
- ...
510
+ .oauth2Login(oauth2Login ->
511
+ oauth2Login
512
+ .userInfoEndpoint(userInfoEndpoint ->
513
+ userInfoEndpoint
514
+ .userService(this.oauth2UserService())
515
+ ...
516
+ )
517
+ );
476
518
}
477
519
478
520
private OAuth2UserService<OAuth2UserRequest, OAuth2User> oauth2UserService() {
@@ -501,10 +543,14 @@ public class OAuth2LoginSecurityConfig extends WebSecurityConfigurerAdapter {
501
543
@Override
502
544
protected void configure(HttpSecurity http) throws Exception {
503
545
http
504
- .oauth2Login()
505
- .userInfoEndpoint()
506
- .oidcUserService(this.oidcUserService())
507
- ...
546
+ .oauth2Login(oauth2Login ->
547
+ oauth2Login
548
+ .userInfoEndpoint(userInfoEndpoint ->
549
+ userInfoEndpoint
550
+ .oidcUserService(this.oidcUserService())
551
+ ...
552
+ )
553
+ );
508
554
}
509
555
510
556
private OAuth2UserService<OidcUserRequest, OidcUser> oidcUserService() {
0 commit comments