-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
PKCE implementation #1784
Merged
Merged
PKCE implementation #1784
Changes from all commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
2879801
Basic implementation of PKCE
Teeed 551a292
@mfmarche on 24 Feb: when code_verifier is set, don't check client_se…
HEllRZA 2688931
@deric on 16 Jun: return invalid_grant when wrong code_verifier
HEllRZA 3c47734
Enforce PKCE flow on /token when PKCE flow was started on /auth
HEllRZA d0fafb0
fixed error messages when mixed PKCE/no PKCE flow.
HEllRZA 492fecf
server_test.go: Added PKCE error cases on /token endpoint
HEllRZA 0c80328
cleanup: extracted method checkErrorResponse and type TestDefinition
HEllRZA 118ab10
/token endpoint: skip client_secret verification only for grand type …
HEllRZA 60b0ec8
Merge branch 'master' of github.com:dexidp/dex into faro-upstream/PKCE
HEllRZA c58264d
Allow "Authorization" header in CORS handlers
HEllRZA 739beef
Add "code_challenge_methods_supported" to discovery endpoint
HEllRZA b79b265
Merge branch 'master' of github.com:dexidp/dex into faro-upstream/PKCE
HEllRZA 06f40be
Merge pull request #4 from faro-oss/faro-upstream/feature/PKCE
HEllRZA 1683a17
Updated tests (mixed-up comments), added a PKCE test
HEllRZA 369674f
Merge pull request #5 from faro-oss/faro-upstream/feature/PKCE
HEllRZA a1aab00
remove redefinition of providedCodeVerifier, fixed spelling (#6)
HEllRZA 7251cd6
Rename struct CodeChallenge to PKCE
HEllRZA b24e4d5
PKCE: Check clientSecret when available
HEllRZA 9faf988
Enable PKCE with public: true
HEllRZA a17bfc1
Redirect error on unsupported code_challenge_method
HEllRZA f78dc9d
Reverted go.mod and go.sum to the state of master
HEllRZA 9b02f80
Merge pull request #7 from faro-oss/faro-upstream/feature/PKCE
HEllRZA 1059ba7
Don't omit client secret check for PKCE
HEllRZA d305bc4
Merge pull request #8 from faro-oss/faro-upstream/feature/PKCE
HEllRZA b6e297b
Allow public clients (e.g. with PKCE) to have redirect URIs configured
heidemn-faro 46c6d9d
Remove "Authorization" as Accepted Headers on CORS, small fixes
HEllRZA 3e86bb6
Merge pull request #9 from faro-oss/faro-upstream/feature/PKCE
HEllRZA 5435741
Revert "Allow public clients (e.g. with PKCE) to have redirect URIs c…
heidemn-faro 7fcf960
Merge pull request #10 from faro-oss/faro-upstream/feature/PKCE
heidemn-faro dd6de36
PKCE on client_secret client error message
HEllRZA 0063431
Merge pull request #11 from faro-oss/faro-upstream/feature/PKCE
HEllRZA a3ed229
Output info message when PKCE without client_secret used on confident…
HEllRZA 3b1f1a5
Merge pull request #12 from faro-oss/faro-upstream/feature/PKCE
HEllRZA 7b369a6
General missing/invalid client_secret message on token endpoint
HEllRZA cbc646f
Merge pull request #13 from faro-oss/faro-upstream/feature/PKCE
HEllRZA File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this case be OK for PKCE? The whole idea is that the client doesn't have to provide the client secret. The role of the IdP in this case is just to verify Code verifier and Code challenge, which happens in
handleAuthCode
.Ref: https://auth0.com/docs/flows/authorization-code-flow-with-proof-key-for-code-exchange-pkce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried rewriting this locally to move the clientSecret validation into
handleAuthCode
,handleRefreshToken
andhandlePasswordGrant
respectively and it works. I think we have to remove it from this function for PKCE to work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a rought sketch of the changes I made, though I'd suggest extracting the client secret validation into its own function instead:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johanbrandhorst
I initially implemented it in a similar way by skipping the client_secret validation, if the request was PKCE.
We decided that, for that case of using PKCE, the client should be configured as public and have no client_secret. And we should not omit the client_secret if the client is confidential. In fact the current implementation checks the client secret either way. Public client just allows an empty secret.
Quote from @tkleczek:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, thanks!