-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Client Secret should not be mandatory #5652
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
Comments
@gburboz Client secret is manadatory for Confidential Clients, which is the case for clients configured for the
As you can see, the
I'm going to close this issue as the implementation is correct. |
@jgrandja , I urge to please reconsider the decision to close this issue or explain why my below interpretation is incorrect. My interpretation of
Furthermore if client secret was not set, where by it was really required, in that case OP will reject the invocation anyhow. |
@jgrandja This statement isn't correct - there's no implication that clients that use authorization code grant are (or must be) confidential clients. The very reason for existence of PKCE (see RFC 7636) is to improve security concerns for public clients that use authorization code grant. To put it in other words, it's the nature of client application that determines whether client registration should be confidential or public, based on application's capability to confidentially store secrets, not the grant flow that is used. Besides, the use implicit grant is generally not recommended for some time now, and both native and single-page apps (i.e. the ones that are not able to store secret confidentially) are encouraged to use authorization code grant without client secret, with an additional layer of security in form of PKCE for native apps. So @gburboz's requirement presented here is perfectly valid as you should be able to use Spring Security in a native app. Of course, as stated above, this should be ideally coupled with PKCE (I see there's #4943) but that's dependent on whether authorization server supports it. |
@vpavic Thanks for the additional details.
Yes this is correct. PKCE is targeted for public clients using the
As you may have noticed, we haven't implemented PKCE with our current implementation of @gburboz Regarding your 3rd point:
Yes, if the provider supports other authentication mechanisms and Spring Security provides that support than Does this answer your question more thoroughly? Is there any other questions you have? |
Apart from implementation effort that is required to make it optional, do you see any reason why client secret should not be made as optional? I am okay to make the necessary change and raise the pull request if that helps. Considering that;
|
As mentioned in my previous comment, the current implementation of Spring Security only supports
True that an empty I agree this is a very simple change to make it optional and we intend on making this change when we implement other authentication mechanisms. I'm really trying to understand your stance on making this optional at this point in time. Are you being blocked from using the client features? If so, can you please provide specific details on your use case so I can better understand? |
@vpavic From your comment
This is not clear to me as the |
@jgrandja I don't think you should be making assumptions on client application's packaging/deployment and capability of storing secrets (which is what should determine whether the client is web or native, and confidential or public) based on the technology used for implementation. These days, you can pretty much package anything inside a container, and likewise, you can run a container pretty much everywhere. Including the environments where you cannot confidentially manage a secret. I'd also add that if someone packages a client secret in an As @gburboz says, the spec permits a client with Token Endpoint authentication method of |
Thanks @vpavic for further clarifications. @jgrandja the spec does not dictate any restrictions on Furthermore to accommodate some non-complying popular social OAuth players, I have raised another spring-security/issues/5657. |
@gburboz After re-reading the spec:
Even though it says REQUIRED it also says the client may omit the parameter if it's an empty string. I find this strange to be honest. Also, if a provider allows an empty client secret to be sent for authentication than this is a pretty serious exposure. Either way, we need to ensure we comply with the spec. |
Thanks for taking up this improvement change request. Yes I agree with you @jgrandja , that statement is self contradictory and it is only said in an alternative scenario when client_secret is sent as request body while no such thing is mentioned for HTTP Basic Auth. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
As per OIDC spec 9. ClientAuthentication one of the client authentication method is
none
hence we should not have client registration'sclient-secret
as mandatoryActual Behavior
Current code validates client secret at following two locations and causes exception
OAuth2ClientProperties.validateRegistration()
ClientRegistration.validateAuthorizationCodeGrantType()
Expected Behavior
Above validations must be removed and
clientId
can be populated as query parameter without any client secret (whenclientAuthenticationMethod
isnone
).Version
Spring Security 5
The text was updated successfully, but these errors were encountered: