Skip to content

Commit 2701d55

Browse files
authored
fix: support path parameters in OAuth2 metadata endpoints (#19729)
Update OAuth2 metadata endpoint routes to support path suffixes This PR updates the OAuth2 metadata endpoint routes to include a wildcard character (*) at the end of the paths. This change allows the endpoints to match requests with path suffixes, making our OAuth2 discovery implementation more flexible and compliant with the relevant RFCs. The updated routes are: - `/.well-known/oauth-authorization-server*` for RFC 8414 discovery - `/.well-known/oauth-protected-resource*` for RFC 9728 discovery
1 parent 6e33c38 commit 2701d55

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

coderd/coderd.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,9 +948,13 @@ func New(options *Options) *API {
948948
}
949949

950950
// OAuth2 metadata endpoint for RFC 8414 discovery
951-
r.Get("/.well-known/oauth-authorization-server", api.oauth2AuthorizationServerMetadata())
951+
r.Route("/.well-known/oauth-authorization-server", func(r chi.Router) {
952+
r.Get("/*", api.oauth2AuthorizationServerMetadata())
953+
})
952954
// OAuth2 protected resource metadata endpoint for RFC 9728 discovery
953-
r.Get("/.well-known/oauth-protected-resource", api.oauth2ProtectedResourceMetadata())
955+
r.Route("/.well-known/oauth-protected-resource", func(r chi.Router) {
956+
r.Get("/*", api.oauth2ProtectedResourceMetadata())
957+
})
954958

955959
// OAuth2 linking routes do not make sense under the /api/v2 path. These are
956960
// for an external application to use Coder as an OAuth2 provider, not for

0 commit comments

Comments
 (0)