You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
609 B
27 lines
609 B
#!/usr/bin/env python3 |
|
import hashlib |
|
import hmac |
|
import os |
|
import time |
|
import urllib.parse |
|
|
|
from dotenv import load_dotenv |
|
|
|
load_dotenv() |
|
|
|
secret = os.getenv("OTB_PORTAL_SHARED_SECRET", "change-me") |
|
uid = os.getenv("OTB_TEST_UID", "1001") |
|
email = os.getenv("OTB_TEST_EMAIL", "client@example.com") |
|
ts = str(int(time.time())) |
|
|
|
payload = f"{uid}|{email}|{ts}".encode("utf-8") |
|
sig = hmac.new(secret.encode("utf-8"), payload, hashlib.sha256).hexdigest() |
|
|
|
params = urllib.parse.urlencode({ |
|
"uid": uid, |
|
"email": email, |
|
"ts": ts, |
|
"sig": sig, |
|
}) |
|
|
|
print(f"http://127.0.0.1:5090/auth/handoff?{params}")
|
|
|