Add Check PCKE Support (#563)
Refer To [Issue 473](https://github.com/modelcontextprotocol/go-sdk/issues/473) Changes: - Add check for PKCE support via server metadata and return an error if not supported.
This commit is contained in:
parent
920e5a39ba
commit
31e97ad69e
1 changed files with 95 additions and 0 deletions
|
|
@ -139,6 +139,11 @@ func GetAuthServerMeta(ctx context.Context, issuerURL string, c *http.Client) (*
|
|||
// Security violation; don't keep trying.
|
||||
return nil, fmt.Errorf("metadata issuer %q does not match issuer URL %q", asm.Issuer, issuerURL)
|
||||
}
|
||||
|
||||
if len(asm.CodeChallengeMethodsSupported) == 0 {
|
||||
return nil, fmt.Errorf("authorization server at %s does not implement PKCE", issuerURL)
|
||||
}
|
||||
|
||||
return asm, nil
|
||||
}
|
||||
errs = append(errs, err)
|
||||
|
|
|
|||
Loading…
Reference in a new issue