Prevent public clients from using the client_credentials grant type #1035
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR updates the
ClientCredentialsGrant
to fail if the client is not confidential.According to the OAuth specification the client credentials grant type should only be used with confidential clients.
https://tools.ietf.org/html/rfc6749#section-4.4.2
While it's possible to check this in the
validateClient
method it's possible the user failed to do so. As explained in #1034 the example repository is not checking this and the docs don't tell you to check this either so it's likely other developers have missed this.By checking it in the
ClientCredentialsGrant
we don't need to require the user to implement the check themselves.I had to update a few tests that were relying on this behavior.