commit
4e3360560a
|
@ -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 {
|
|||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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…
Reference in New Issue