Documentation
¶
Index ¶
- func AuthN(verifier TokenVerifier) func(http.HandlerFunc) http.HandlerFunc
- func ClaimsFromContext(ctx context.Context) map[string]any
- func NewBearerAuth(verifier TokenVerifier) *bearerAuth
- func NewMiddleware(verifier TokenVerifier) func(http.HandlerFunc) http.HandlerFunc
- func SessionFromContext(ctx context.Context) *schema.Session
- func UserFromContext(ctx context.Context) *schema.User
- type Policy
- type TokenVerifier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthN ¶
func AuthN(verifier TokenVerifier) func(http.HandlerFunc) http.HandlerFunc
AuthN returns an HTTP middleware that verifies a locally issued JWT, extracts the embedded session and user claims, and rejects revoked or expired sessions or users. If any check fails, a 401 Unauthorized response is returned with a WWW-Authenticate header containing the error details.
func ClaimsFromContext ¶
ClaimsFromContext returns JWT claims stored by the auth middleware.
func NewBearerAuth ¶
func NewBearerAuth(verifier TokenVerifier) *bearerAuth
func NewMiddleware ¶
func NewMiddleware(verifier TokenVerifier) func(http.HandlerFunc) http.HandlerFunc
NewMiddleware is kept as a compatibility wrapper for existing callers.
func SessionFromContext ¶
SessionFromContext returns the authenticated session stored by the auth middleware.
Types ¶
type Policy ¶
A policy object is used to implement authorization checks on the user
func MatchScopes ¶
Click to show internal directories.
Click to hide internal directories.