Versions in this module Expand all Collapse all v0 v0.2.0 Mar 8, 2026 v0.1.0 Feb 28, 2026 Changes in this version + const ContextKeyAPIKey + const ContextKeyPrincipal + func APIKeyMiddleware(config APIKeyMiddlewareConfig) func(http.Handler) http.Handler + func ChiAuth(jwtService *jwt.Service) func(http.Handler) http.Handler + func ChiAuthOptional(jwtService *jwt.Service) func(http.Handler) http.Handler + func ChiRequireAnyPermission(permissions ...string) func(http.Handler) http.Handler + func ChiRequireAnyRole(roles ...string) func(http.Handler) http.Handler + func ChiRequireOrganization() func(http.Handler) http.Handler + func ChiRequirePermission(permission string) func(http.Handler) http.Handler + func ChiRequirePlatformAdmin() func(http.Handler) http.Handler + func ChiRequireRole(role string) func(http.Handler) http.Handler + func ClaimsFromContext(ctx context.Context) *jwt.Claims + func ContextWithClaims(ctx context.Context, claims *jwt.Claims) context.Context + func GetAPIKey(ctx context.Context) *apikey.APIKey + func HTTPAuth(jwtService *jwt.Service) func(http.Handler) http.Handler + func HTTPAuthOptional(jwtService *jwt.Service) func(http.Handler) http.Handler + func HasAllPermissions(ctx context.Context, permissions ...string) bool + func HasAnyPermission(ctx context.Context, permissions ...string) bool + func HasAnyRole(ctx context.Context, roles ...string) bool + func HasPermission(ctx context.Context, permission string) bool + func HasRole(ctx context.Context, role string) bool + func IsPlatformAdminFromContext(ctx context.Context) bool + func OptionalAPIKey(service *apikey.Service) func(http.Handler) http.Handler + func OrganizationIDFromContext(ctx context.Context) *uuid.UUID + func PermissionsFromContext(ctx context.Context) []string + func RequireAPIKey(service *apikey.Service) func(http.Handler) http.Handler + func RequireAPIKeyWithScopes(service *apikey.Service, scopes ...string) func(http.Handler) http.Handler + func RequireAnyPermission(permissions ...string) func(http.Handler) http.Handler + func RequireAnyRole(roles ...string) func(http.Handler) http.Handler + func RequireAnyScope(scopes ...string) func(http.Handler) http.Handler + func RequireOrganization() func(http.Handler) http.Handler + func RequirePermission(permission string) func(http.Handler) http.Handler + func RequirePlatformAdmin() func(http.Handler) http.Handler + func RequireRole(role string) func(http.Handler) http.Handler + func RequireScope(scope string) func(http.Handler) http.Handler + func RoleFromContext(ctx context.Context) string + func UserIDFromContext(ctx context.Context) uuid.UUID + type APIKeyMiddlewareConfig struct + AllowQueryParam bool + AnyScopes []string + HeaderName string + IPExtractor func(r *http.Request) string + OnError func(w http.ResponseWriter, r *http.Request, err error) + OnSuccess func(r *http.Request, key *apikey.APIKey) + QueryParamName string + RecordUsage bool + RequiredScopes []string + Service *apikey.Service + func DefaultAPIKeyMiddlewareConfig() APIKeyMiddlewareConfig + type ErrorResponse struct + Error string + Message string + type Principal struct + Environment string + ID uuid.UUID + Metadata map[string]string + OrganizationID *uuid.UUID + Scopes []string + Type string + UserID uuid.UUID + func GetPrincipal(ctx context.Context) *Principal + func (p *Principal) HasScope(scope string) bool + func (p *Principal) IsAPIKey() bool + func (p *Principal) IsUser() bool