Documentation
¶
Overview ¶
Package defaults provides the core Aegis route mounting with OpenAPI documentation.
This package exists as a sub-package of router to break the circular import between router and plugins/openapi:
defaults → router (for Router interface and MountRoutes) defaults → plugins/openapi (for Doc/Route types) plugins/openapi → router (for MountRoutes Router param)
No cycle: router does NOT import defaults, plugins/openapi does NOT import defaults.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MountRoutes ¶
func MountRoutes(r router.Router, authService *core.AuthService, config *core.AuthConfig, prefix string, rateLimiter *core.RateLimiter)
MountRoutes mounts all core Aegis authentication routes and registers their OpenAPI documentation.
This function:
- Registers HTTP handlers directly
- Calls openapi.Doc() for each route to register API documentation
Routes mounted:
POST {prefix}/login - Email+password login (if enabled)
POST {prefix}/signup - Email+password registration (if enabled)
POST {prefix}/logout - Invalidate session (auth required)
GET {prefix}/session - Get current session with user data (auth required)
GET {prefix}/sessions - List all user sessions (auth required)
DELETE {prefix}/sessions/{id} - Revoke specific session (auth required)
DELETE {prefix}/sessions - Revoke all sessions (auth required)
POST {prefix}/session/refresh - Refresh session with refresh token
Parameters:
- r: HTTP router implementing the Router interface
- authService: Core authentication service with all sub-services
- config: Authentication configuration (controls which routes are enabled)
- prefix: URL prefix for all routes (e.g., "/auth/default")
- rateLimiter: Optional rate limiter for public endpoints (can be nil)
Types ¶
type Handlers ¶
type Handlers struct {
// contains filtered or unexported fields
}
Handlers provides HTTP handlers for core Aegis authentication routes.
All handlers have been made private (lowercase) to encourage programmatic use of the underlying core services. This struct serves as a mounting point for the router.
func NewHandlers ¶
func NewHandlers(auth *core.AuthService) *Handlers
NewHandlers creates a new Handlers instance with the given AuthService.