mirror of
https://github.com/revanced/revanced-polling-api.git
synced 2025-05-02 15:44:33 +02:00
refactor(auth): use hmac.compare_digest
This commit is contained in:
parent
40d51afd1f
commit
c8e203f740
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import hmac
|
||||||
from fastapi_paseto_auth import AuthPASETO
|
from fastapi_paseto_auth import AuthPASETO
|
||||||
from fastapi import APIRouter, Request, Response, Depends, status, HTTPException, Header
|
from fastapi import APIRouter, Request, Response, Depends, status, HTTPException, Header
|
||||||
from app.dependencies import load_config
|
from app.dependencies import load_config
|
||||||
@ -22,7 +23,11 @@ async def auth(request: Request, response: Response, client: ClientModels.Client
|
|||||||
access_token: auth token
|
access_token: auth token
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if client.id == os.environ['CLIENT_ID'] and client.secret == os.environ['CLIENT_SECRET']:
|
if(
|
||||||
|
hmac.compare_digest(client.id, os.environ['CLIENT_ID']) and
|
||||||
|
hmac.compare_digest(client.secret, os.environ['CLIENT_SECRET'])
|
||||||
|
):
|
||||||
|
|
||||||
authenticated: bool = True
|
authenticated: bool = True
|
||||||
|
|
||||||
if not authenticated:
|
if not authenticated:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user