Demosthene-OR
commited on
Commit
•
8a563be
1
Parent(s):
0160c14
Update main.py
Browse files
main.py
CHANGED
@@ -87,11 +87,11 @@ async def validation_exception_handler(request: Request, exc: ValidationError):
|
|
87 |
|
88 |
|
89 |
# Fonction pour vérifier l'authentification de l'utilisateur
|
90 |
-
def authenticate(
|
91 |
-
if not
|
92 |
raise HTTPException(status_code=401, detail="Utilisateur non authorisé1")
|
93 |
try:
|
94 |
-
scheme, credentials =
|
95 |
if scheme != 'Basic':
|
96 |
raise HTTPException(status_code=401, detail="Utilisateur non authorisé "+scheme)
|
97 |
username, password = credentials.split(":")
|
|
|
87 |
|
88 |
|
89 |
# Fonction pour vérifier l'authentification de l'utilisateur
|
90 |
+
def authenticate(Authorization: str = Header(None)):
|
91 |
+
if not Authorization:
|
92 |
raise HTTPException(status_code=401, detail="Utilisateur non authorisé1")
|
93 |
try:
|
94 |
+
scheme, credentials = Authorization.split()
|
95 |
if scheme != 'Basic':
|
96 |
raise HTTPException(status_code=401, detail="Utilisateur non authorisé "+scheme)
|
97 |
username, password = credentials.split(":")
|