Weglot for Datasnipper - updated templates. Approved to move Walmart screenshots scripts to a cloud host. Need to re-write it in playwright
This commit is contained in:
23
Scripts/base64_test_sps.py
Normal file
23
Scripts/base64_test_sps.py
Normal file
@ -0,0 +1,23 @@
|
||||
import base64
|
||||
import hashlib
|
||||
import hmac
|
||||
import json
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
|
||||
def verify_northpass_authorization(auth_token: str, request_data: dict) -> bool:
|
||||
"""
|
||||
Verifies that the authorization token is valid.
|
||||
|
||||
Args:
|
||||
auth_token: The authorization token provided from Northpass
|
||||
request_data: The data provided by Northpass
|
||||
|
||||
Returns: True if the authorization token is valid or False if not
|
||||
"""
|
||||
asm_northpass_secret = "EXAMPLE-SECRET".encode("utf-8")
|
||||
encoded_body = json.dumps(request_data.__dict__, separators=(",", ":")).encode("utf-8")
|
||||
asm_hash = hmac.new(key=asm_northpass_secret, msg=encoded_body, digestmod=hashlib.sha256).digest()
|
||||
return auth_token == base64.b64encode(asm_hash).decode("utf-8")
|
||||
|
||||
Reference in New Issue
Block a user