Documentation
¶
Overview ¶
Package authn provides transport middleware for Kernel authentication.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BearerExtractor ¶
func BearerExtractor(h transport.Header) (rootauthn.Credential, bool)
BearerExtractor extracts an Authorization: Bearer <token> credential.
func Server ¶
func Server(opts ...Option) middleware.Middleware
Server authenticates the caller and stores the normalized principal in both authn and contextx contexts so old and new Kernel packages see the same identity.
Types ¶
type CredentialExtractor ¶
type CredentialExtractor func(transport.Header) (rootauthn.Credential, bool)
CredentialExtractor extracts an authn credential from transport headers.
func HeaderExtractor ¶
func HeaderExtractor(headerName, scheme string) CredentialExtractor
HeaderExtractor extracts a token directly from a named header. It is useful for dev-token, API-key and mTLS adapter tests where the upstream identity has already been verified.
type Option ¶
type Option func(*options)
Option configures Server.
func WithAllowAnonymous ¶
WithAllowAnonymous lets unauthenticated requests continue as anonymous.
func WithAuthenticator ¶
func WithAuthenticator(a rootauthn.Authenticator) Option
WithAuthenticator configures the authenticator used by Server.
func WithCredentialExtractor ¶
func WithCredentialExtractor(extractor CredentialExtractor) Option
WithCredentialExtractor configures how credentials are extracted.