feat: add helper scripts for infrastructure management and troubleshooting
This commit is contained in:
26
scripts/test_oidc_callback_live.py
Normal file
26
scripts/test_oidc_callback_live.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import urllib.request
|
||||
import ssl
|
||||
|
||||
ctx = ssl.create_default_context()
|
||||
ctx.check_hostname = False
|
||||
ctx.verify_mode = ssl.CERT_NONE
|
||||
|
||||
class NoRedirectHandler(urllib.request.HTTPRedirectHandler):
|
||||
def redirect_request(self, req, fp, code, msg, headers, newurl):
|
||||
return None
|
||||
|
||||
opener = urllib.request.build_opener(NoRedirectHandler)
|
||||
|
||||
url = "https://semaphore.snarfnet.net/api/auth/oidc/authentik/redirect?code=sample&state=sample"
|
||||
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
|
||||
try:
|
||||
resp = opener.open(req)
|
||||
print("Status:", resp.status)
|
||||
print("Headers:", resp.headers)
|
||||
except urllib.error.HTTPError as e:
|
||||
print("HTTPError:", e.code, e.reason)
|
||||
print("Location:", e.headers.get('Location'))
|
||||
print("Body:", e.read().decode('utf-8', errors='replace'))
|
||||
except Exception as e:
|
||||
print("Error:", e)
|
||||
|
||||
Reference in New Issue
Block a user