middleware

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(providers []string, validator TokenValidator, resolver ActorResolver) func(http.Handler) http.Handler

AuthMiddleware extracts the credentials (JWT or API Key) and injects the Actor into the context.

func ForContext

func ForContext(ctx context.Context) (identity.Actor, bool)

ForContext retrieves the Actor from the context and a boolean indicating success.

func WithActor

func WithActor(ctx context.Context, actor identity.Actor) context.Context

WithActor returns a new context with the given actor.

Types

type ActorResolver

type ActorResolver interface {
	GetActorByAPIKey(ctx context.Context, key string) (identity.Actor, error)
}

ActorResolver defines the interface for resolving API Keys.

type TokenValidator

type TokenValidator interface {
	ValidateToken(ctx context.Context, token string) (identity.Actor, error)
}

TokenValidator defines an interface for validating authentication tokens.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL