-
Notifications
You must be signed in to change notification settings - Fork 1.3k
client_id and client_secret provided via query parameters are accepted for client_secret_post #1378
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
@idotobi As per spec,
Although it's NOT RECOMMENDED, it is a valid option and no where in the spec does it say it's not allowed. It does state...
I'm going to close this as |
@jgrandja Thank you for your reply. I know that
At least that's how I would understand this sentence. |
@idotobi Apologies, as I misread your original comment and this issue is valid. Thank you for your persistence 👍 Re-opening and will apply a fix before the release this coming Tue. |
@jgrandja No worries. Glad I could help to improve the project 🙂 Thanks for your work 🙏 ! |
Describe the bug
When a client has the authentication method
client_secret_post
enabled, token requests like the following succeed:However, according to The OAuth 2.1 Authorization Framework specification they must not.
To Reproduce
samples/default-authorizationserver/src/main/resources/application.yml
oauth2: authorizationserver: client: messaging-client: registration: client-id: "messaging-client" client-secret: "{noop}secret" client-authentication-methods: registration: client-id: "messaging-client" client-secret: "{noop}secret" client-authentication-methods: - "client_secret_basic" + - "client_secret_post" authorization-grant-types: - "authorization_code" - "refresh_token" - "client_credentials"
./gradlew -b samples/default-authorizationserver/samples-default-authorizationserver.gradle bootRun
curl -X POST "http://localhost:9000/oauth2/token?client_id=messaging-client&client_secret=secret&grant_type=client_credentials"
Expected behavior
The specification does not directly say what should be returned in this case.
I would think that one of the following two responses would be reasonable (with a slight preference for 1):
Further Notes
As far as I understand, this is caused by the usage of
OAuth2EndpointUtils.getParameters(request)
inspring-authorization-server/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/web/authentication/ClientSecretPostAuthenticationConverter.java
Line 50 in 2dcbc58
jakarta.servlet.ServletRequest#getParameterMap
, which according to the docs includes both body and query parameters in the returned map.The text was updated successfully, but these errors were encountered: