Skip to main content

Module auth

Module auth 

Source
Expand description

Authentication and authorization middleware.

This module provides API key and JWT token validation for the baseline service.

Structs§

ApiKey
Represents an authenticated API key.
ApiKeyStore
In-memory API key store for development and testing.
AuthContext
Authenticated user context extracted from requests.
AuthState
Authentication state shared by middleware.
JwtClaims
JWT claims accepted by the server.
JwtConfig
JWT validation settings.

Enums§

Role
Role-based access control.
Scope
Permission scope for API operations.

Functions§

auth_middleware
Authentication middleware.
check_scope
Checks if the current auth context has the required scope, project access, and benchmark access. Returns an error response if the scope is not present, project mismatch, or benchmark restricted.
local_mode_auth_middleware
Local-mode middleware that injects a synthetic admin auth context.
validate_key_format
Validates API key format.