Skip to content

clientSecret property is not required #14156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*
* @author Madhura Bhave
* @author Phillip Webb
* @author Artsiom Yudovin
*/
@ConfigurationProperties(prefix = "spring.security.oauth2.client")
public class OAuth2ClientProperties {
Expand Down Expand Up @@ -61,9 +62,6 @@ private void validateRegistration(Registration registration) {
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.");
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* Tests for {@link OAuth2ClientProperties}.
*
* @author Madhura Bhave
* @author Artsiom Yudovin
*/
public class OAuth2ClientPropertiesTests {

Expand All @@ -44,13 +45,11 @@ public void clientIdAbsentThrowsException() {
}

@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();
}

Expand Down