Documentation
¶
Overview ¶
Package httphandler registers the HTTP handlers which sign people in with providers, such as Google, GitHub and LDAP, and exchange who they are for what the server makes of it
Index ¶
Constants ¶
This section is empty.
Variables ¶
var HandlerDoc []byte
Functions ¶
func Providers ¶ added in v0.0.15
func Providers(providers []provider.Provider) []schema.ProviderMeta
Providers returns what the providers are, for anyone to see, such as on a sign-in page, or in the server's configuration
func RegisterHandlers ¶ added in v0.0.15
RegisterHandlers registers signing in with the providers, which need unique names: listing them, a redirect provider's sign-in and callback, and a password provider's sign-in
func ResourceMetadataPath ¶ added in v0.0.15
ResourceMetadataPath is the path of the protected resource metadata of the API, at prefix, such as /api, which a 401's challenge refers to
Types ¶
type ExchangeFunc ¶ added in v0.0.15
ExchangeFunc is what's done with an identity, once someone has signed in, whose result is the response, or whose error refuses it
type Opt ¶ added in v0.0.15
type Opt func(*options) error
Opt is an option of the handlers
func WithBaseURL ¶ added in v0.0.15
WithBaseURL is the URL the server is reached at, such as https://auth.example.com, which providers redirect back to. Without it, it's the request's scheme and host.
func WithExchange ¶ added in v0.0.15
func WithExchange(fn ExchangeFunc, response *jsonschema.Schema) Opt
WithExchange does fn with an identity, once someone has signed in, and returns its result, whose schema is the response's, in the OpenAPI specification, such as a session's. Without it, the identity is returned.
func WithKey ¶ added in v0.0.15
WithKey seals the state of sign-ins with the key, of 32 bytes, so they can be completed by another server with the key, or after a restart. Without it, the key is random.
func WithOAuth ¶ added in v0.0.15
WithOAuth makes the server an OAuth authorization server, as MCP clients expect, which issues its sessions to clients: it publishes its metadata, registers clients, and authorizes them, for someone who's signed in, with a code, which they exchange, with PKCE, for a session's token. It needs WithSessions. Clients are redirected to loopback URIs, such as http://127.0.0.1:8080/callback, on any port, or to one of the redirects, such as https://app.example.com/callback, exactly, as people aren't asked to approve them.
func WithSessions ¶ added in v0.0.15
func WithSessions(sessions store.SessionStore) Opt
WithSessions sets a session's token as a cookie, when signing in is exchanged for a session, for a browser, and registers getting the session and signing out, which need the security scheme, which is registered first
func WithSignIn ¶ added in v0.0.15
WithSignIn is the path of the sign-in page, such as /login, which authorizing a client redirects to, with the path to return to, as return, when no one's signed in. Without it, it's the redirect provider's sign-in, when there's only one.