21 lines
529 B
Python
21 lines
529 B
Python
import sys
|
|
|
|
from fastapi import HTTPException
|
|
|
|
from dump_things_service import (
|
|
HTTP_401_UNAUTHORIZED,
|
|
)
|
|
from dump_things_service.instance_state import InstanceState
|
|
|
|
|
|
def authenticate_admin(
|
|
instance_state: InstanceState,
|
|
api_key: str,
|
|
):
|
|
print('IMPLEMENT: authenticate_admin() ', file=sys.stderr, flush=True)
|
|
if api_key != 'admin-1':
|
|
detail = f'invalid admin token: {api_key}'
|
|
raise HTTPException(
|
|
status_code=HTTP_401_UNAUTHORIZED,
|
|
detail=detail,
|
|
)
|