Skip to content

Commit 6be4307

Browse files
ayudovinmbhave
authored andcommitted
OAuth2 client secret property should not be required
1 parent caf7221 commit 6be4307

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
*
3131
* @author Madhura Bhave
3232
* @author Phillip Webb
33+
* @author Artsiom Yudovin
3334
*/
3435
@ConfigurationProperties(prefix = "spring.security.oauth2.client")
3536
public class OAuth2ClientProperties {
@@ -61,9 +62,6 @@ private void validateRegistration(Registration registration) {
6162
if (!StringUtils.hasText(registration.getClientId())) {
6263
throw new IllegalStateException("Client id must not be empty.");
6364
}
64-
if (!StringUtils.hasText(registration.getClientSecret())) {
65-
throw new IllegalStateException("Client secret must not be empty.");
66-
}
6765
}
6866

6967
/**

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* Tests for {@link OAuth2ClientProperties}.
2525
*
2626
* @author Madhura Bhave
27+
* @author Artsiom Yudovin
2728
*/
2829
public class OAuth2ClientPropertiesTests {
2930

@@ -44,13 +45,11 @@ public void clientIdAbsentThrowsException() {
4445
}
4546

4647
@Test
47-
public void clientSecretAbsentThrowsException() {
48+
public void clientSecretAbsentNotThrowsException() {
4849
OAuth2ClientProperties.Registration registration = new OAuth2ClientProperties.Registration();
4950
registration.setClientId("foo");
5051
registration.setProvider("google");
5152
this.properties.getRegistration().put("foo", registration);
52-
this.thrown.expect(IllegalStateException.class);
53-
this.thrown.expectMessage("Client secret must not be empty.");
5453
this.properties.validate();
5554
}
5655

0 commit comments

Comments
 (0)