From 7f5604cd2a58a9bd1ce0ee6cea6ea637d242f0b0 Mon Sep 17 00:00:00 2001 From: hibobmaster <32976627+hibobmaster@users.noreply.github.com> Date: Wed, 15 Nov 2023 22:42:02 +0800 Subject: [PATCH] Use client-secret to authenticate --- config.json.example | 4 ++-- src/main.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/config.json.example b/config.json.example index ef22132..8b3692a 100644 --- a/config.json.example +++ b/config.json.example @@ -1,8 +1,8 @@ { "turnstile_secret_key": "1x0000000000000000000000000000000AA", "keycloak_server_url": "xxxxxxxxx", - "keycloak_admin_username": "xxxxxxx", - "keycloak_admin_password": "xxxxxxxx", + "keycloak_client_id": "admin-cli", + "keycloak_client_secret_key": "xxxxxxx", "keycloak_realm_name": "master", "open_registration": true } diff --git a/src/main.py b/src/main.py index f3a284f..9efe601 100644 --- a/src/main.py +++ b/src/main.py @@ -81,16 +81,16 @@ with open("config.json", "r") as f: config = json.load(f) turnstile_secret_key = config["turnstile_secret_key"] keycloak_server_url = config["keycloak_server_url"] - keycloak_admin_username = config["keycloak_admin_username"] - keycloak_admin_password = config["keycloak_admin_password"] + keycloak_client_id = config["keycloak_client_id"] + keycloak_client_secret_key = config["keycloak_client_secret_key"] keycloak_realm_name = config["keycloak_realm_name"] open_registration = config["open_registration"] keycloak_connection = KeycloakOpenIDConnection( server_url=keycloak_server_url, - username=keycloak_admin_username, - password=keycloak_admin_password, realm_name=keycloak_realm_name, + client_id=keycloak_client_id, + client_secret_key=keycloak_client_secret_key, verify=True, )