oauth

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetadataHandler

func NewMetadataHandler(config MetadataHandlerConfig) http.HandlerFunc

NewMetadataHandler creates an HTTP handler that serves OAuth 2.0 protected resource metadata

Types

type ClientInfo added in v0.17.0

type ClientInfo struct {
	Name     string   `json:"name"`
	ClientID string   `json:"client_id"`
	Scopes   []string `json:"scopes"`
}

ClientInfo represents an OAuth client configuration for external integrations.

type MetadataHandlerConfig

type MetadataHandlerConfig struct {
	ResourceName         string
	ResourceURL          string
	AuthorizationServers []string
	// ScopesSupported is advertised as scopes_supported in the protected-resource
	// metadata (RFC 9728). MCP clients prefer this list over the authorization
	// server's scopes_supported — critical when the AS (e.g. Cognito) advertises
	// pool-level scopes that a specific app client doesn't allow.
	ScopesSupported []string
	Clients         []ClientInfo
	SecurityEnabled bool
	Logger          *slog.Logger
}

MetadataHandlerConfig holds configuration for the OAuth metadata handler

type ProtectedResourceMetadata

type ProtectedResourceMetadata struct {
	ResourceName              string       `json:"resource_name"`
	Resource                  string       `json:"resource"`
	AuthorizationServers      []string     `json:"authorization_servers"`
	BearerMethodsSupported    []string     `json:"bearer_methods_supported"`
	ScopesSupported           []string     `json:"scopes_supported"`
	OpenChoreoClients         []ClientInfo `json:"openchoreo_clients,omitempty"`
	OpenChoreoSecurityEnabled bool         `json:"openchoreo_security_enabled"`
}

ProtectedResourceMetadata represents OAuth 2.0 protected resource metadata as defined in RFC 9728. Additional OpenChoreo-specific extension fields use the openchoreo_ prefix as permitted by RFC 9728 §2.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL