Browse Source

Merge branch '3.3.x'

Closes gh-42280
pull/42289/head
Moritz Halbritter 1 year ago
parent
commit
ce01dbbad4
  1. 7
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientProperties.java
  2. 2
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesTests.java

7
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientProperties.java

@ -31,6 +31,7 @@ import org.springframework.util.StringUtils; @@ -31,6 +31,7 @@ import org.springframework.util.StringUtils;
* @author Phillip Webb
* @author Artsiom Yudovin
* @author MyeongHyeon Lee
* @author Moritz Halbritter
* @since 2.0.0
*/
@ConfigurationProperties(prefix = "spring.security.oauth2.client")
@ -60,12 +61,12 @@ public class OAuth2ClientProperties implements InitializingBean { @@ -60,12 +61,12 @@ public class OAuth2ClientProperties implements InitializingBean {
}
public void validate() {
getRegistration().values().forEach(this::validateRegistration);
getRegistration().forEach(this::validateRegistration);
}
private void validateRegistration(Registration registration) {
private void validateRegistration(String id, Registration registration) {
if (!StringUtils.hasText(registration.getClientId())) {
throw new IllegalStateException("Client id must not be empty.");
throw new IllegalStateException("Client id of registration '%s' must not be empty.".formatted(id));
}
}

2
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2ClientPropertiesTests.java

@ -37,7 +37,7 @@ class OAuth2ClientPropertiesTests { @@ -37,7 +37,7 @@ class OAuth2ClientPropertiesTests {
registration.setProvider("google");
this.properties.getRegistration().put("foo", registration);
assertThatIllegalStateException().isThrownBy(this.properties::validate)
.withMessageContaining("Client id must not be empty.");
.withMessageContaining("Client id of registration 'foo' must not be empty.");
}
@Test

Loading…
Cancel
Save