Documentation
¶
Overview ¶
Package auth provides the small authentication boundary needed by HTTP applications without owning identity-provider setup, sessions, or application authorization.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrUnauthenticated = errors.New("unauthenticated")
ErrUnauthenticated reports absent, invalid, or expired credentials. An Authenticator should wrap this error when the client may safely retry with different credentials. Other errors are treated as internal failures.
Functions ¶
Types ¶
type Authenticator ¶
Authenticator establishes the principal for an HTTP request.
func Bearer ¶
func Bearer(verifier TokenVerifier) Authenticator
Bearer builds an Authenticator for RFC 6750 Authorization headers.
type AuthenticatorFunc ¶
AuthenticatorFunc adapts a named function to Authenticator, following the same interface-plus-function pattern as http.Handler and http.HandlerFunc.
func (AuthenticatorFunc) Authenticate ¶
func (f AuthenticatorFunc) Authenticate(r *http.Request) (Principal, error)
Authenticate calls f(r).
type Principal ¶
Principal identifies one authenticated subject. Issuer and Subject form the stable identity key used by OpenID Connect and prevent subject collisions between identity providers.
func PrincipalFromContext ¶
PrincipalFromContext returns the principal established by Require.
func PrincipalFromRequest ¶
PrincipalFromRequest returns the principal established for r.
type TokenVerifier ¶
TokenVerifier validates a bearer token and returns its stable principal. OIDC and other federated adapters can implement this interface without coupling provider-specific claims to the server package.
type TokenVerifierFunc ¶
TokenVerifierFunc adapts a named function to TokenVerifier.
func (TokenVerifierFunc) VerifyToken ¶
VerifyToken calls f(ctx, token).