8000 feat: add OAuth2 protected resource metadata endpoint for RFC 9728 by ThomasK33 · Pull Request #18643 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: add OAuth2 protected resource metadata endpoint for RFC 9728 #18643

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: thomask33/feat_add_Go_LSP_configuration_and_code_navigation_documentation
Choose a base branch
from

Conversation

ThomasK33
Copy link
Member

Add OAuth2 Protected Resource Metadata Endpoint

This PR implements the OAuth2 Protected Resource Metadata endpoint according to RFC 9728. The endpoint is available at /.well-known/oauth-protected-resource and provides information about Coder as an OAuth2 protected resource.

Key changes:

  • Added a new endpoint at /.well-known/oauth-protected-resource that returns metadata about Coder as an OAuth2 protected resource
  • Created a new OAuth2ProtectedResourceMetadata struct in the SDK
  • Added tests to verify the endpoint functionality
  • Updated API documentation to include the new endpoint

The implementation currently returns basic metadata including the resource identifier and authorization server URL. The scopes_supported field is empty until a scope system based on RBAC permissions is implemented. The bearer_methods_supported field is omitted as Coder uses custom authentication methods rather than standard RFC 6750 bearer tokens.

A TODO has been added to implement RFC 6750 bearer token support in the future.

- Add OAuth2ProtectedResourceMetadata struct in codersdk/oauth2.go
- Implement /.well-known/oauth-protected-resource endpoint handler
- Register route in coderd.go for Protected Resource Metadata discovery
- Add comprehensive test coverage in oauth2_metadata_test.go
- Update OpenAPI documentation and generated API types
- Correctly omit bearer_methods_supported field (Coder uses custom auth)
- Support MCP OAuth2 compliance requirement for resource server metadata

This implements RFC 9728 OAuth 2.0 Protected Resource Metadata to enable
MCP clients to discover resource server capabilities and authorization servers.

Change-Id: I089232ae755acf13eb0a7be46944c9eeaaafb75b
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33 ThomasK33 force-pushed the thomask33/06-27-feat_oauth2_implement_rfc_9728_protected_resource_metadata_endpoint branch from 5be6c6a to fded148 Compare June 27, 2025 17:29
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_add_Go_LSP_configuration_and_code_navigation_documentation branch from 1e2bc51 to 3de973b Compare June 27, 2025 17:29
@ThomasK33 ThomasK33 marked this pull request as ready for review June 29, 2025 11:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0