Added authentication
This commit is contained in:
20
backend/routes/config.py
Normal file
20
backend/routes/config.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from fastapi import APIRouter
|
||||
from config import (
|
||||
AUTH_ENABLED,
|
||||
AUTH_TENANT_ID,
|
||||
AUTH_CLIENT_ID,
|
||||
AUTH_SCOPE,
|
||||
)
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/config/auth")
|
||||
def auth_config():
|
||||
return {
|
||||
"auth_enabled": AUTH_ENABLED,
|
||||
"tenant_id": AUTH_TENANT_ID,
|
||||
"client_id": AUTH_CLIENT_ID,
|
||||
"scope": AUTH_SCOPE,
|
||||
"redirect_uri": None, # frontend uses window.location.origin by default
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi import APIRouter, HTTPException, Depends
|
||||
from database import events_collection
|
||||
from auth import require_auth
|
||||
|
||||
router = APIRouter()
|
||||
router = APIRouter(dependencies=[Depends(require_auth)])
|
||||
|
||||
|
||||
@router.get("/events")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi import APIRouter, HTTPException, Depends
|
||||
from pymongo import UpdateOne
|
||||
|
||||
from database import events_collection
|
||||
@@ -6,8 +6,9 @@ from graph.audit_logs import fetch_audit_logs
|
||||
from sources.unified_audit import fetch_unified_audit
|
||||
from sources.intune_audit import fetch_intune_audit
|
||||
from models.event_model import normalize_event
|
||||
from auth import require_auth
|
||||
|
||||
router = APIRouter()
|
||||
router = APIRouter(dependencies=[Depends(require_auth)])
|
||||
|
||||
|
||||
def run_fetch(hours: int = 168):
|
||||
|
||||
Reference in New Issue
Block a user