Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthFromContext ¶
func AuthFromContext(ctx context.Context) *model.AuthContext
AuthFromContext extracts the AuthContext from ctx. Returns nil if not set.
func WithAuthContext ¶
WithAuthContext sets the AuthContext in ctx. Used by handlers and tests.
Types ¶
type APIKeyLookup ¶
type APIKeyLookup interface {
GetByPlaintext(ctx context.Context, plaintext string) (*model.APIKey, error)
TouchLastUsed(ctx context.Context, id string) error
}
APIKeyLookup is the interface for looking up API keys by plaintext.
type Audit ¶
type Audit struct {
// contains filtered or unexported fields
}
Audit is the audit-logging middleware.
func NewAudit ¶
func NewAudit(writer AuditWriter) *Audit
NewAudit creates an Audit middleware backed by the given writer.
type AuditWriter ¶
type AuditWriter interface {
Append(ctx context.Context, e *model.AuditEntry) error
}
AuditWriter can persist audit log entries.
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is the authentication middleware.
func NewAuth ¶
func NewAuth(clerk *ClerkVerifier, keys APIKeyLookup) *Auth
NewAuth creates a new Auth middleware.
type ClerkVerifier ¶
type ClerkVerifier struct {
// contains filtered or unexported fields
}
ClerkVerifier verifies Clerk JWTs by fetching and caching JWKS keys.
func NewClerkVerifier ¶
func NewClerkVerifier(jwksURL string) *ClerkVerifier
NewClerkVerifier creates a ClerkVerifier that fetches keys from jwksURL.
type Quota ¶
type Quota struct {
// contains filtered or unexported fields
}
Quota is the request-quota enforcement middleware.
func NewQuota ¶
func NewQuota(usage UsageCounter, tenants QuotaTenantLookup) *Quota
NewQuota creates a Quota middleware.