- Notifications
You must be signed in to change notification settings - Fork1k
Commit09c5055
authored
feat: implement RFC 6750 Bearer token authentication (#18644)
# Add RFC 6750 Bearer Token Authentication SupportThis PR implements RFC 6750 Bearer Token authentication as an additional authentication method for Coder's API. This allows clients to authenticate using standard OAuth 2.0 Bearer tokens in two ways:1. Using the `Authorization: Bearer <token>` header2. Using the `access_token` query parameterKey changes:- Added support for extracting tokens from both Bearer headers and access_token query parameters- Implemented proper WWW-Authenticate headers for 401/403 responses with appropriate error descriptions- Added comprehensive test coverage for the new authentication methods- Updated the OAuth2 protected resource metadata endpoint to advertise Bearer token support- Enhanced the OAuth2 testing script to verify Bearer token functionalityThese authentication methods are added as fallback options, maintaining backward compatibility with Coder's existing authentication mechanisms. The existing authentication methods (cookies, session token header, etc.) still take precedence.This implementation follows the OAuth 2.0 Bearer Token specification (RFC 6750) and improves interoperability with standard OAuth 2.0 clients.1 parenteade5b0 commit09c5055
File tree
7 files changed
+784
-7
lines changed- coderd
- httpmw
- scripts/oauth2
7 files changed
+784
-7
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
214 | 214 |
| |
215 | 215 |
| |
216 | 216 |
| |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
217 | 242 |
| |
218 | 243 |
| |
219 | 244 |
| |
| |||
653 | 678 |
| |
654 | 679 |
| |
655 | 680 |
| |
| 681 | + | |
| 682 | + | |
656 | 683 |
| |
657 | 684 |
| |
658 | 685 |
| |
| 686 | + | |
| 687 | + | |
| 688 | + | |
659 | 689 |
| |
660 | 690 |
| |
661 | 691 |
| |
| |||
671 | 701 |
| |
672 | 702 |
| |
673 | 703 |
| |
674 |
| - | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
675 | 716 |
| |
676 | 717 |
| |
677 | 718 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
102 | 102 |
| |
103 | 103 |
| |
104 | 104 |
| |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
105 | 111 |
| |
106 | 112 |
| |
107 | 113 |
| |
|
0 commit comments
Comments
(0)