private-gpt/private_gpt
lopagela aa70d3d9f0
Add simple Basic auth (#1203)
* Add simple Basic auth

To enable the basic authentication, one must set `server.auth.enabled`
to true.

The static string defined in `server.auth.secret` must be set in the
header `Authorization`.

The health check endpoint will always be accessible, no matter the API
auth configuration.

* Fix linting and type check

* Fighting with mypy being too restrictive

Had to disable mypy in the `auth` as we are not using the same signature
for the authenticated method.

mypy was complaining that the signatures of `authenticated` must be
identical, no matter in which logical branch we are.
Given that fastapi is accomodating itself of method signatures (it will
inject the dependencies in the method call), this warning of mypy is
actually preventing us to do something legit.

mypy doc: https://mypy.readthedocs.io/en/stable/common_issues.html

* Write tests to verify that the simple auth is working
2023-11-12 19:05:00 +01:00
..
components Update poetry lock (#1209) 2023-11-11 22:44:19 +01:00
open_ai Update poetry lock (#1209) 2023-11-11 22:44:19 +01:00
server Add simple Basic auth (#1203) 2023-11-12 19:05:00 +01:00
settings Add simple Basic auth (#1203) 2023-11-12 19:05:00 +01:00
ui Curate sources to avoid the UI crashing (#1212) 2023-11-12 10:59:51 +01:00
utils Next version of PrivateGPT (#1077) 2023-10-19 16:04:35 +02:00
__init__.py feat: Disable Gradio Analytics (#1165) 2023-11-06 14:31:26 +01:00
__main__.py feat: Drop loguru and use builtin `logging` (#1133) 2023-10-29 19:11:02 +01:00
constants.py Next version of PrivateGPT (#1077) 2023-10-19 16:04:35 +02:00
di.py Next version of PrivateGPT (#1077) 2023-10-19 16:04:35 +02:00
main.py Add basic CORS (#1198) 2023-11-10 14:29:43 +01:00
paths.py Next version of PrivateGPT (#1077) 2023-10-19 16:04:35 +02:00