Replace deprecated constant_time_compare

The method is being deprecated now[1].

[1] https://review.opendev.org/c/openstack/oslo.utils/+/930198

Closes-Bug: #2081732
Change-Id: Icd707efef0375f4938cd60376b892430c36083c7
This commit is contained in:
Takashi Kajinami 2024-10-02 18:34:03 +09:00
parent 1067fb95b0
commit c1faa8478c

View File

@ -20,7 +20,6 @@ import json
import os
import uuid
from oslo_utils import secretutils
from oslo_utils import uuidutils
@ -107,7 +106,7 @@ def signed_unpack(data, hmac_data, hmac_keys):
except Exception: # nosec
pass
else:
if secretutils.constant_time_compare(hmac_data, user_hmac_data):
if hmac.compare_digest(hmac_data, user_hmac_data):
try:
contents = json.loads(
binary_decode(base64.urlsafe_b64decode(data)))