Commit 3f095c13 authored by Madhura Bhave's avatar Madhura Bhave

Merge pull request #14156 from ayudovin

* gh-14156:
  Polish "OAuth2 client secret should not be required"
  OAuth2 client secret property should not be required
parents caf72214 d07e2fa0
......@@ -30,6 +30,7 @@ import org.springframework.util.StringUtils;
*
* @author Madhura Bhave
* @author Phillip Webb
* @author Artsiom Yudovin
*/
@ConfigurationProperties(prefix = "spring.security.oauth2.client")
public class OAuth2ClientProperties {
......@@ -61,9 +62,6 @@ public class OAuth2ClientProperties {
if (!StringUtils.hasText(registration.getClientId())) {
throw new IllegalStateException("Client id must not be empty.");
}
if (!StringUtils.hasText(registration.getClientSecret())) {
throw new IllegalStateException("Client secret must not be empty.");
}
}
/**
......
......@@ -24,6 +24,7 @@ import org.junit.rules.ExpectedException;
* Tests for {@link OAuth2ClientProperties}.
*
* @author Madhura Bhave
* @author Artsiom Yudovin
*/
public class OAuth2ClientPropertiesTests {
......@@ -44,13 +45,11 @@ public class OAuth2ClientPropertiesTests {
}
@Test
public void clientSecretAbsentThrowsException() {
public void clientSecretAbsentShouldNotThrowException() {
OAuth2ClientProperties.Registration registration = new OAuth2ClientProperties.Registration();
registration.setClientId("foo");
registration.setProvider("google");
this.properties.getRegistration().put("foo", registration);
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Client secret must not be empty.");
this.properties.validate();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment