Skip to content

Client Secret should not be mandatory #5652

Closed
@gburboz

Description

@gburboz

Summary

As per OIDC spec 9. ClientAuthentication one of the client authentication method is none hence we should not have client registration's client-secret as mandatory

Actual Behavior

Current code validates client secret at following two locations and causes exception

OAuth2ClientProperties.validateRegistration()

Caused by: java.lang.IllegalStateException: Client secret must not be empty.
	at org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties.validateRegistration(OAuth2ClientProperties.java:65) ~[spring-boot-autoconfigure-2.0.4.RELEASE.jar:2.0.4.RELEASE]

ClientRegistration.validateAuthorizationCodeGrantType()

Caused by: java.lang.IllegalArgumentException: clientSecret cannot be empty
	at org.springframework.util.Assert.hasText(Assert.java:276) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.security.oauth2.client.registration.ClientRegistration$Builder.validateAuthorizationCodeGrantType(ClientRegistration.java:437) ~[spring-security-oauth2-client-5.0.7.RELEASE.jar:5.0.7.RELEASE]

Expected Behavior

Above validations must be removed and clientId can be populated as query parameter without any client secret (when clientAuthenticationMethod is none).

Version

Spring Security 5

Metadata

Metadata

Assignees

Labels

in: oauth2An issue in OAuth2 modules (oauth2-core, oauth2-client, oauth2-resource-server, oauth2-jose)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions