OAuth2 client secret property should not be required
This commit is contained in:
parent
caf7221485
commit
6be4307712
|
@ -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 clientSecretAbsentNotThrowsException() {
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue