Skip to content

Commit d172cd5

Browse files
committed
revert
1 parent f60582b commit d172cd5

2 files changed

Lines changed: 0 additions & 53 deletions

File tree

server/handlers.go

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -103,36 +103,6 @@ type discoveryOAuth2 struct {
103103
AuthMethods []string `json:"token_endpoint_auth_methods_supported,omitempty"`
104104
}
105105

106-
// protectedResourceMetadata represents the OAuth 2.0 Protected Resource Metadata
107-
// defined in RFC 9728. This enables MCP clients to discover the authorization
108-
// server(s) that protect this resource.
109-
type protectedResourceMetadata struct {
110-
Resource string `json:"resource"`
111-
AuthorizationServers []string `json:"authorization_servers"`
112-
ScopesSupported []string `json:"scopes_supported,omitempty"`
113-
BearerMethodsSupported []string `json:"bearer_methods_supported,omitempty"`
114-
}
115-
116-
func (s *Server) handleProtectedResourceMetadata(w http.ResponseWriter, r *http.Request) {
117-
meta := protectedResourceMetadata{
118-
Resource: s.issuerURL.String(),
119-
AuthorizationServers: []string{s.issuerURL.String()},
120-
ScopesSupported: []string{"openid", "email", "groups", "profile", "offline_access"},
121-
BearerMethodsSupported: []string{"header"},
122-
}
123-
124-
data, err := json.MarshalIndent(meta, "", " ")
125-
if err != nil {
126-
s.logger.ErrorContext(r.Context(), "failed to marshal protected resource metadata", "err", err)
127-
s.renderError(r, w, http.StatusInternalServerError, "Internal server error.")
128-
return
129-
}
130-
131-
w.Header().Set("Content-Type", "application/json")
132-
w.Header().Set("Content-Length", strconv.Itoa(len(data)))
133-
w.Write(data)
134-
}
135-
136106
type DiscoveryType int
137107

138108
const (

server/handlers_test.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -151,29 +151,6 @@ func TestHandleDiscoveryOAuth2(t *testing.T) {
151151
}, res)
152152
}
153153

154-
func TestHandleProtectedResourceMetadata(t *testing.T) {
155-
httpServer, server := newTestServer(t, nil)
156-
defer httpServer.Close()
157-
158-
rr := httptest.NewRecorder()
159-
server.ServeHTTP(rr, httptest.NewRequest("GET", "/.well-known/oauth-protected-resource", nil))
160-
161-
if rr.Code != http.StatusOK {
162-
t.Errorf("expected 200 got %d", rr.Code)
163-
}
164-
165-
var res protectedResourceMetadata
166-
err := json.NewDecoder(rr.Result().Body).Decode(&res)
167-
require.NoError(t, err)
168-
169-
require.Equal(t, protectedResourceMetadata{
170-
Resource: httpServer.URL,
171-
AuthorizationServers: []string{httpServer.URL},
172-
ScopesSupported: []string{"openid", "email", "groups", "profile", "offline_access"},
173-
BearerMethodsSupported: []string{"header"},
174-
}, res)
175-
}
176-
177154
func TestHandleHealthFailure(t *testing.T) {
178155
httpServer, server := newTestServer(t, func(c *Config) {
179156
c.HealthChecker = gosundheit.New()

0 commit comments

Comments
 (0)