You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
added optional global AppAPIAuth middleware (#205)
For some applications it will be useful to simply set global
authentication to all endpoints and not write in each endpoint:
New:
```python3
APP = FastAPI(lifespan=lifespan)
APP.add_middleware(ex_app.AppAPIAuthMiddleware)
```
Old:
```python3
@APP.post("/verify_initial_value")
async def verify_initial_value(
_nc: typing.Annotated[NextcloudApp, Depends(nc_app)], # <---- this is no needed when using new Global Middleware
input1: Button1Format,
):
print("Old value: ", input1.initial_value)
return responses.JSONResponse(content={"initial_value": str(random.randint(0, 100))}, status_code=200)
```
Limitations:
`Talk bots` endpoints using another Auth type, and they should be added
to `disable_for` parameter of `AppAPIAuthMiddleware`.
---------
Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
0 commit comments