Skip to content

Commit

Permalink
feat: define MASTER_REALM constant and update auth login message to u…
Browse files Browse the repository at this point in the history
…se it
  • Loading branch information
SanjeevLakhwani committed Mar 3, 2025
1 parent 491293d commit 1f339ed
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions py_bentoctl/auth_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
KC_ADMIN_API_CLIENTS_ENDPOINT = f"{KC_ADMIN_API_ENDPOINT}/clients"
KC_ADMIN_API_CLIENT_SCOPES = f"{KC_ADMIN_API_ENDPOINT}/client-scopes"

MASTER_REALM = "master"


def check_auth_admin_user():
if not AUTH_ADMIN_USER:
Expand Down Expand Up @@ -332,7 +334,7 @@ def init_auth(docker_client: docker.DockerClient):
check_auth_admin_user()

def get_session():
realm = AUTH_REALM if SETUP_EXTERNAL_KEYCLOAK else "master"
realm = AUTH_REALM if SETUP_EXTERNAL_KEYCLOAK else MASTER_REALM
res = keycloak_req(
f"realms/{realm}/protocol/openid-connect/token",
method="post",
Expand Down Expand Up @@ -553,7 +555,7 @@ def success():
subprocess.check_call((*c.COMPOSE, "up", "--wait", "-d", "auth", "gateway"))
success()

info(f" Signing into {AUTH_REALM if SETUP_EXTERNAL_KEYCLOAK else "master"} realm as {AUTH_ADMIN_USER}...")
info(f" Signing into {AUTH_REALM if SETUP_EXTERNAL_KEYCLOAK else MASTER_REALM} realm as {AUTH_ADMIN_USER}...")
session = get_session()
access_token = session["access_token"]
success()
Expand Down

0 comments on commit 1f339ed

Please sign in to comment.