Implement complete Bearer Token and API key authentication system
- Create comprehensive authentication backend with JWT and API key support - Add database models for users, API keys, and tokens with proper security - Implement authentication middleware and API endpoints - Build complete frontend authentication UI with: - LoginForm component with JWT authentication - APIKeyManager for creating and managing API keys - AuthDashboard for comprehensive auth management - AuthContext for state management and authenticated requests - Initialize database with default admin user (admin/admin123) - Add proper token refresh, validation, and blacklisting - Implement scope-based API key authorization system 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -12,8 +12,7 @@ import socketio
|
||||
from .core.hive_coordinator import HiveCoordinator
|
||||
from .core.distributed_coordinator import DistributedCoordinator
|
||||
from .core.database import engine, get_db, init_database_with_retry, test_database_connection
|
||||
from .core.auth import get_current_user
|
||||
from .api import agents, workflows, executions, monitoring, projects, tasks, cluster, distributed_workflows, cli_agents
|
||||
from .api import agents, workflows, executions, monitoring, projects, tasks, cluster, distributed_workflows, cli_agents, auth
|
||||
# from .mcp.distributed_mcp_server import get_mcp_server
|
||||
from .models.user import Base
|
||||
from .models import agent, project # Import the new agent and project models
|
||||
@@ -35,6 +34,11 @@ async def lifespan(app: FastAPI):
|
||||
print("📊 Initializing database...")
|
||||
init_database_with_retry()
|
||||
|
||||
# Initialize auth database tables and initial data
|
||||
print("🔐 Initializing authentication system...")
|
||||
from .core.init_db import initialize_database
|
||||
initialize_database()
|
||||
|
||||
# Test database connection
|
||||
if not test_database_connection():
|
||||
raise Exception("Database connection test failed")
|
||||
@@ -100,6 +104,7 @@ app.add_middleware(
|
||||
)
|
||||
|
||||
# Include API routes
|
||||
app.include_router(auth.router, prefix="/api/auth", tags=["authentication"])
|
||||
app.include_router(agents.router, prefix="/api", tags=["agents"])
|
||||
app.include_router(workflows.router, prefix="/api", tags=["workflows"])
|
||||
app.include_router(executions.router, prefix="/api", tags=["executions"])
|
||||
|
||||
Reference in New Issue
Block a user