trivial: remove compatibility-code for python < 3.6 (#61119)
This commit is contained in:
parent
51cf94a801
commit
a33834b613
|
@ -18,17 +18,9 @@ import base64
|
|||
import datetime
|
||||
import logging
|
||||
import math
|
||||
from binascii import Error as Base64Error
|
||||
|
||||
try:
|
||||
from secrets import compare_digest
|
||||
except ImportError:
|
||||
|
||||
def compare_digest(a, b):
|
||||
return a == b
|
||||
|
||||
|
||||
import secrets
|
||||
import time
|
||||
from binascii import Error as Base64Error
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
|
@ -533,7 +525,7 @@ def authenticate_client_secret(client, client_secret):
|
|||
raw_provided_client_secret = client_secret.encode('utf-8')
|
||||
if len(raw_client_client_secret) != len(raw_provided_client_secret):
|
||||
raise WrongClientSecret(client=client, wrong_id=raw_provided_client_secret)
|
||||
if not compare_digest(raw_client_client_secret, raw_provided_client_secret):
|
||||
if not secrets.compare_digest(raw_client_client_secret, raw_provided_client_secret):
|
||||
raise WrongClientSecret(client=client, wrong_id=raw_provided_client_secret)
|
||||
return client
|
||||
|
||||
|
|
Loading…
Reference in New Issue