Documentation
¶
Overview ¶
Package mcp provides Model Context Protocol-flavored helpers on top of authlet's AS. Currently:
- PRM (RFC 9728 Protected Resource Metadata) JSON handler
- WWW-Authenticate challenge string with resource_metadata pointer
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChallengeHeader ¶
ChallengeHeader builds a WWW-Authenticate value pointing at the PRM URL. Use it in your 401 responses (or rely on pkg/rs.Middleware, which sets this automatically when ResourceMetadata is configured).
func PRMHandler ¶
func PRMHandler(p PRM) http.HandlerFunc
PRMHandler returns an http.HandlerFunc that serves the given PRM document as JSON with a public Cache-Control header. Mount it at the .well-known/oauth-protected-resource path appropriate for the resource. Only GET is accepted; other methods receive 405.
Types ¶
type PRM ¶
type PRM struct {
// Resource is the canonical URL of the protected resource.
Resource string `json:"resource"`
// AuthorizationServers lists the issuer URLs that may mint tokens for
// this resource.
AuthorizationServers []string `json:"authorization_servers"`
// BearerMethodsSupported enumerates how clients may present bearer
// tokens (e.g. "header", "body", "query"). Optional.
BearerMethodsSupported []string `json:"bearer_methods_supported,omitempty"`
// ScopesSupported lists scope values the resource recognises. Optional.
ScopesSupported []string `json:"scopes_supported,omitempty"`
}
PRM is the Protected Resource Metadata JSON document defined by RFC 9728. It advertises which authorization servers can issue tokens for the resource and which bearer methods and scopes the resource accepts.