Commit 6be43077 authored by artsiom's avatar artsiom Committed by Madhura Bhave

OAuth2 client secret property should not be required

parent caf72214
...@@ -30,6 +30,7 @@ import org.springframework.util.StringUtils; ...@@ -30,6 +30,7 @@ import org.springframework.util.StringUtils;
* *
* @author Madhura Bhave * @author Madhura Bhave
* @author Phillip Webb * @author Phillip Webb
* @author Artsiom Yudovin
*/ */
@ConfigurationProperties(prefix = "spring.security.oauth2.client") @ConfigurationProperties(prefix = "spring.security.oauth2.client")
public class OAuth2ClientProperties { public class OAuth2ClientProperties {
...@@ -61,9 +62,6 @@ public class OAuth2ClientProperties { ...@@ -61,9 +62,6 @@ public class OAuth2ClientProperties {
if (!StringUtils.hasText(registration.getClientId())) { if (!StringUtils.hasText(registration.getClientId())) {
throw new IllegalStateException("Client id must not be empty."); 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; ...@@ -24,6 +24,7 @@ import org.junit.rules.ExpectedException;
* Tests for {@link OAuth2ClientProperties}. * Tests for {@link OAuth2ClientProperties}.
* *
* @author Madhura Bhave * @author Madhura Bhave
* @author Artsiom Yudovin
*/ */
public class OAuth2ClientPropertiesTests { public class OAuth2ClientPropertiesTests {
...@@ -44,13 +45,11 @@ public class OAuth2ClientPropertiesTests { ...@@ -44,13 +45,11 @@ public class OAuth2ClientPropertiesTests {
} }
@Test @Test
public void clientSecretAbsentThrowsException() { public void clientSecretAbsentNotThrowsException() {
OAuth2ClientProperties.Registration registration = new OAuth2ClientProperties.Registration(); OAuth2ClientProperties.Registration registration = new OAuth2ClientProperties.Registration();
registration.setClientId("foo"); registration.setClientId("foo");
registration.setProvider("google"); registration.setProvider("google");
this.properties.getRegistration().put("foo", registration); this.properties.getRegistration().put("foo", registration);
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Client secret must not be empty.");
this.properties.validate(); 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