Initial curated Unraid-AppOps-Gateway source from 3bd6f6fee310125bfbb4d4650389a817f498724d
This commit is contained in:
commit
1dfbca08a1
528 files changed
+131054
No files matched your search
@@ -0,0 +1,92 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from ..connectors.authentik import AuthentikConnector
|
||||
from .connector_runtime import load_connector_runtime
|
||||
|
||||
router = APIRouter(prefix='/api/apps/authentik', dependencies=[Depends(load_connector_runtime)])
|
||||
|
||||
|
||||
def _shape(payload: dict[str, Any]) -> dict[str, Any]:
|
||||
data = payload.get('data')
|
||||
if not isinstance(data, dict):
|
||||
data = {key: value for key, value in payload.items() if key not in {'success', 'status', 'message'}}
|
||||
return {
|
||||
**payload,
|
||||
'success': bool(payload.get('success')),
|
||||
'status': str(payload.get('status', 'ok')),
|
||||
'message': str(payload.get('message', 'ok')),
|
||||
'data': data,
|
||||
}
|
||||
|
||||
|
||||
def _connector() -> AuthentikConnector:
|
||||
return AuthentikConnector()
|
||||
|
||||
|
||||
@router.get('/health')
|
||||
def health():
|
||||
return _shape(_connector().health())
|
||||
|
||||
|
||||
@router.get('/system')
|
||||
def system_status():
|
||||
return _shape(_connector().system_status())
|
||||
|
||||
|
||||
@router.get('/applications')
|
||||
def applications():
|
||||
return _shape(_connector().applications())
|
||||
|
||||
|
||||
@router.get('/providers')
|
||||
def providers():
|
||||
return _shape(_connector().providers())
|
||||
|
||||
|
||||
@router.get('/providers/proxy')
|
||||
def proxy_providers():
|
||||
return _shape(_connector().proxy_providers())
|
||||
|
||||
|
||||
@router.get('/providers/oauth2')
|
||||
def oauth2_providers():
|
||||
return _shape(_connector().oauth2_providers())
|
||||
|
||||
|
||||
@router.get('/outposts')
|
||||
def outposts():
|
||||
return _shape(_connector().outposts())
|
||||
|
||||
|
||||
@router.get('/outposts/health')
|
||||
def outpost_health():
|
||||
return _shape(_connector().outpost_health())
|
||||
|
||||
|
||||
@router.get('/flows')
|
||||
def flows_summary():
|
||||
return _shape(_connector().flows_summary())
|
||||
|
||||
|
||||
@router.get('/policies')
|
||||
def policies_summary():
|
||||
return _shape(_connector().policies_summary())
|
||||
|
||||
|
||||
@router.get('/events')
|
||||
def events(limit: int = 25):
|
||||
return _shape(_connector().events(limit))
|
||||
|
||||
|
||||
@router.get('/auth-coverage')
|
||||
def auth_coverage():
|
||||
return _shape(_connector().auth_coverage())
|
||||
|
||||
|
||||
@router.get('/security-warnings')
|
||||
def security_warnings():
|
||||
return _shape(_connector().security_warnings())
|
||||
Reference in new issue
Block a user