Add Check PCKE Support#563
Merged
samthanawalla merged 9 commits intomodelcontextprotocol:mainfrom Oct 14, 2025
Merged
Conversation
samthanawalla
suggested changes
Oct 7, 2025
Contributor
samthanawalla
left a comment
There was a problem hiding this comment.
Thanks for the PR!
I moved some stuff around so you will have to rebase!
oauthex/oauthex.go
Outdated
| // RequirePKCE checks that the authorization server for issuerURL supports PKCE, | ||
| // by verifying that CodeChallengeMethodsSupported is non-empty. | ||
| // It returns an error if metadata cannot be fetched or PKCE is not advertised. | ||
| func RequirePKCE(ctx context.Context, issuerURL string, c *http.Client) error { |
Contributor
There was a problem hiding this comment.
move this to auth_meta after rebasing
6d6e1c2 to
40f7fb4
Compare
Contributor
Author
|
Hi @samthanawalla updated, kindly help to review again. thanks! |
jba
requested changes
Oct 8, 2025
oauthex/auth_meta.go
Outdated
| return nil, fmt.Errorf("failed to get auth server metadata from %q: %w", issuerURL, errors.Join(errs...)) | ||
| } | ||
|
|
||
| // RequirePKCE checks that the authorization server for issuerURL supports PKCE, |
Contributor
There was a problem hiding this comment.
I don't think we should have an exported function for this. Why can't we do it inside GetAuthServerMeta?
jba
requested changes
Oct 10, 2025
oauthex/auth_meta_test.go
Outdated
| } | ||
| } | ||
|
|
||
| func TestGetAuthServerMetaRequirePKCE(t *testing.T) { |
Contributor
There was a problem hiding this comment.
This doesn't actually test that we do the check. There needs to be a test for an auth server that doesn't do PKCE.
jba
requested changes
Oct 13, 2025
oauthex/auth_meta_test.go
Outdated
| tests := []struct { | ||
| name string | ||
| hasPKCESupport bool | ||
| expectError bool |
Contributor
There was a problem hiding this comment.
Also wantError can be a string, if empty, then no error is expected, otherwise the error should contain that string.
jba
approved these changes
Oct 14, 2025
appleboy
approved these changes
Oct 14, 2025
samthanawalla
approved these changes
Oct 14, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refer To Issue 473
Changes: