Commit bf94a06
Fall through to well-known discovery when resource metadata auth fails (#4371)
When a server returns resource_metadata in its WWW-Authenticate header,
Priority 3 (RFC 9728) would hard-return on any failure, preventing
Priorities 4 and 5 from running. For servers like Sourcegraph and
Deepsearch whose authorization_servers list contains path-based URLs
(e.g. /.api/mcp/deepsearch), RFC 8414 tenant extraction generates
/.well-known/oauth-authorization-server/.api/mcp/deepsearch — an
endpoint those servers don't serve. Validation fails, Priority 3
errors, and auth is broken despite Priorities 4/5 being able to
derive the correct root-domain issuer.
Fix by capturing the error from tryDiscoverFromResourceMetadata and
only returning on success; failures now log at DEBUG and fall through
to well-known probing (Priority 4) and URL-derived issuer (Priority 5),
restoring the behaviour that existed before 6cad0b5.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 6b8f044 commit bf94a06
2 files changed
Lines changed: 13 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
337 | 341 | | |
338 | 342 | | |
339 | 343 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | | - | |
179 | | - | |
180 | | - | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
| 445 | + | |
446 | 446 | | |
447 | | - | |
448 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
449 | 450 | | |
450 | 451 | | |
451 | 452 | | |
| |||
0 commit comments