39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
import urllib.request
|
|
import ssl
|
|
import json
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
ctx = ssl.create_default_context()
|
|
ctx.check_hostname = False
|
|
ctx.verify_mode = ssl.CERT_NONE
|
|
|
|
token = "SnarfNetPermanentAutomationToken2026"
|
|
headers = {
|
|
"Authorization": f"Bearer {token}",
|
|
"Content-Type": "application/json"
|
|
}
|
|
|
|
def api_call(url, method="GET", payload=None):
|
|
data = json.dumps(payload).encode('utf-8') if payload else None
|
|
req = urllib.request.Request(url, headers=headers, data=data, method=method)
|
|
with urllib.request.urlopen(req, context=ctx, timeout=15) as resp:
|
|
return json.loads(resp.read().decode('utf-8'))
|
|
|
|
payload = {
|
|
"mode": "forward_domain",
|
|
"external_host": "https://authentik.snarfnet.net",
|
|
"cookie_domain": "snarfnet.net",
|
|
"redirect_uris": [
|
|
{
|
|
"matching_mode": "strict",
|
|
"url": "https://authentik.snarfnet.net/outpost.goauthentik.io/callback?X-authentik-auth-callback=true"
|
|
}
|
|
]
|
|
}
|
|
|
|
res12 = api_call("https://authentik.snarfnet.net/api/v3/providers/proxy/12/", method="PATCH", payload=payload)
|
|
print("Updated Provider 12:", res12.get('name'), "| Mode:", res12.get('mode'), "| Cookie Domain:", res12.get('cookie_domain'))
|
|
|