mcp/internal/oauthex: auth server metadata (#294)
Implement the Authorization Server Metadata spec.
This commit is contained in:
parent
40b6bd30f1
commit
2a00640e1e
1 changed files with 293 additions and 26 deletions
28
internal/oauthex/auth_meta_test.go
Normal file
28
internal/oauthex/auth_meta_test.go
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright 2025 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package oauthex
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAuthMetaParse(t *testing.T) {
|
||||
// Verify that we parse Google's auth server metadata.
|
||||
data, err := os.ReadFile(filepath.FromSlash("testdata/google-auth-meta.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var a AuthServerMeta
|
||||
if err := json.Unmarshal(data, &a); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// Spot check.
|
||||
if g, w := a.Issuer, "https://accounts.google.com"; g != w {
|
||||
t.Errorf("got %q, want %q", g, w)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue