Repository navigation
Commit 0b55cbb
committed
Use none as the token-endpoint auth method for CIMD public clients
A client identified by a Client ID Metadata Document is a public client:
its identifier is a URL and it has no client secret, so it must
authenticate at the token endpoint with 'none' and prove possession via
PKCE. Previously ApplyClientIdMetadataDocument left the auth method
unset, so GetAccessTokenAsync fell through to the first method the
authorization server advertised. Servers like Auth0 advertise
client_secret_basic first, which made the token exchange send a Basic
header built from the CIMD URL and an empty secret and omit client_id
from the body, so the exchange failed with 401 access_denied.
ApplyClientIdMetadataDocument now sets the auth method to 'none'. The
test OAuth server can advertise an arbitrary ordered auth-method list,
and a new regression test proves a CIMD client authenticates when the
server advertises client_secret_basic before none.
Fixes modelcontextprotocol#16121 parent c40ee04 commit 0b55cbb
3 files changed
Lines changed: 47 additions & 1 deletion
File tree
- src/ModelContextProtocol.Core/Authentication
- tests
- ModelContextProtocol.AspNetCore.Tests/OAuth
- ModelContextProtocol.TestOAuthServer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
497 | 504 | | |
498 | 505 | | |
499 | 506 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
363 | 391 | | |
364 | 392 | | |
365 | 393 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
83 | 94 | | |
84 | 95 | | |
85 | 96 | | |
| |||
276 | 287 | | |
277 | 288 | | |
278 | 289 | | |
279 | | - | |
| 290 | + | |
280 | 291 | | |
281 | 292 | | |
282 | 293 | | |
| |||
0 commit comments