Documentation
¶
Overview ¶
Package oidc serves OAuth/OIDC discovery documents for MCP servers.
Index ¶
- func JWKSHandler(manager *keys.Manager) http.Handler
- type DiscoveryConfig
- func (d DiscoveryConfig) AuthorizationServerHandler() http.Handler
- func (d DiscoveryConfig) AuthorizationServerMetadata() map[string]any
- func (d DiscoveryConfig) OpenIDConfiguration() map[string]any
- func (d DiscoveryConfig) OpenIDConfigurationHandler() http.Handler
- func (d DiscoveryConfig) ProtectedResourceHandler(resourceURL string) http.Handler
- func (d DiscoveryConfig) ProtectedResourceMetadata(resourceURL string) ProtectedResourceMetadata
- func (d DiscoveryConfig) RegisterRoutes(mux *http.ServeMux, cfg RouteConfig)
- type ProtectedResourceMetadata
- type RouteConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DiscoveryConfig ¶
type DiscoveryConfig struct {
Issuer string
AuthorizationEndpoint string
TokenEndpoint string
JWKSEndpoint string
RevocationEndpoint string
RegistrationEndpoint string
ScopesSupported []string
}
DiscoveryConfig holds values needed to build discovery documents.
func NewDiscoveryConfig ¶
func NewDiscoveryConfig(issuerURL string, scopes []string) DiscoveryConfig
NewDiscoveryConfig builds a discovery config from an issuer URL.
func (DiscoveryConfig) AuthorizationServerHandler ¶
func (d DiscoveryConfig) AuthorizationServerHandler() http.Handler
AuthorizationServerHandler returns a handler for /.well-known/oauth-authorization-server.
func (DiscoveryConfig) AuthorizationServerMetadata ¶
func (d DiscoveryConfig) AuthorizationServerMetadata() map[string]any
AuthorizationServerMetadata returns RFC 8414 metadata.
func (DiscoveryConfig) OpenIDConfiguration ¶
func (d DiscoveryConfig) OpenIDConfiguration() map[string]any
OpenIDConfiguration returns the OIDC discovery document. The same shape is also valid OAuth authorization server metadata for the kit's supported flows.
func (DiscoveryConfig) OpenIDConfigurationHandler ¶
func (d DiscoveryConfig) OpenIDConfigurationHandler() http.Handler
OpenIDConfigurationHandler returns a handler for /.well-known/openid-configuration.
func (DiscoveryConfig) ProtectedResourceHandler ¶
func (d DiscoveryConfig) ProtectedResourceHandler(resourceURL string) http.Handler
ProtectedResourceHandler returns a handler for /.well-known/oauth-protected-resource.
func (DiscoveryConfig) ProtectedResourceMetadata ¶
func (d DiscoveryConfig) ProtectedResourceMetadata(resourceURL string) ProtectedResourceMetadata
ProtectedResourceMetadata returns metadata for an MCP protected resource.
func (DiscoveryConfig) RegisterRoutes ¶
func (d DiscoveryConfig) RegisterRoutes(mux *http.ServeMux, cfg RouteConfig)
RegisterRoutes mounts discovery routes. If ResourceURL is empty, it uses issuer + "/mcp".
type ProtectedResourceMetadata ¶
type ProtectedResourceMetadata struct {
Resource string `json:"resource"`
AuthorizationServers []string `json:"authorization_servers"`
BearerMethodsSupported []string `json:"bearer_methods_supported"`
ScopesSupported []string `json:"scopes_supported,omitempty"`
}
ProtectedResourceMetadata is RFC 9728 protected resource metadata.
type RouteConfig ¶
RouteConfig configures mounted discovery routes.