|
1 | 1 | /* |
2 | | - * Copyright 2002-2022 the original author or authors. |
| 2 | + * Copyright 2002-2025 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -258,24 +258,22 @@ public void buildWhenAuthorizationCodeGrantClientAuthenticationMethodNotProvided |
258 | 258 | } |
259 | 259 |
|
260 | 260 | @Test |
261 | | - public void buildWhenAuthorizationCodeGrantRedirectUriIsNullThenThrowIllegalArgumentException() { |
262 | | - assertThatIllegalArgumentException().isThrownBy(() -> |
| 261 | + public void buildWhenAuthorizationCodeGrantRedirectUriIsNullThenDefaultsToLoginOAuth2Code() { |
263 | 262 | // @formatter:off |
264 | | - ClientRegistration.withRegistrationId(REGISTRATION_ID) |
265 | | - .clientId(CLIENT_ID) |
266 | | - .clientSecret(CLIENT_SECRET) |
267 | | - .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC) |
268 | | - .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE) |
269 | | - .redirectUri(null) |
270 | | - .scope(SCOPES.toArray(new String[0])) |
271 | | - .authorizationUri(AUTHORIZATION_URI) |
272 | | - .tokenUri(TOKEN_URI) |
273 | | - .userInfoAuthenticationMethod(AuthenticationMethod.FORM) |
274 | | - .jwkSetUri(JWK_SET_URI) |
275 | | - .clientName(CLIENT_NAME) |
276 | | - .build() |
| 263 | + ClientRegistration registration = ClientRegistration.withRegistrationId(REGISTRATION_ID) |
| 264 | + .clientId(CLIENT_ID) |
| 265 | + .clientSecret(CLIENT_SECRET) |
| 266 | + .clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC) |
| 267 | + .authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE) |
| 268 | + .scope(SCOPES.toArray(new String[0])) |
| 269 | + .authorizationUri(AUTHORIZATION_URI) |
| 270 | + .tokenUri(TOKEN_URI) |
| 271 | + .userInfoAuthenticationMethod(AuthenticationMethod.FORM) |
| 272 | + .jwkSetUri(JWK_SET_URI) |
| 273 | + .clientName(CLIENT_NAME) |
| 274 | + .build(); |
277 | 275 | // @formatter:on |
278 | | - ); |
| 276 | + assertThat(registration.getRedirectUri()).isEqualTo("{baseUrl}/login/oauth2/code/" + REGISTRATION_ID); |
279 | 277 | } |
280 | 278 |
|
281 | 279 | // gh-5494 |
|
0 commit comments