20 lines
646 B
Python
20 lines
646 B
Python
|
import logging
|
||
|
from app import dependencies
|
||
|
from app.authentik.api import Authentik
|
||
|
from app.event_controller import Authentik_Hook_Model, EventController, Http_request
|
||
|
from fastapi import APIRouter, Depends
|
||
|
|
||
|
from app.authentik.settings import AuthentikSettings
|
||
|
|
||
|
router = APIRouter()
|
||
|
|
||
|
@router.post("/authentik/hook/")
|
||
|
async def hook(model: Authentik_Hook_Model,
|
||
|
http_request: Http_request,
|
||
|
):
|
||
|
logging.info(model)
|
||
|
logging.info(http_request)
|
||
|
ec = EventController(Authentik(AuthentikSettings()))
|
||
|
if http_request.path == "/api/v3/core/users/":
|
||
|
ec.handle_model_created_event(model)
|
||
|
return 200
|