go-sdk/internal/oauthex/auth_meta_test.go
Jonathan Amsterdam 2a00640e1e
mcp/internal/oauthex: auth server metadata (#294)
Implement the Authorization Server Metadata spec.
2025-09-05 14:17:21 -04:00

28 lines
659 B
Go

// 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)
}
}