members.lumbung.space/members_lumbung_space/keycloak.py

22 lines
468 B
Python
Raw Normal View History

2022-01-10 12:34:17 +00:00
"""Keycloak logic."""
from keycloak import KeycloakAdmin
def init_keycloak():
"""Initialise Keycloak client."""
from members_lumbung_space.config import (
KEYCLOAK_CLIENT_SECRET,
KEYCLOAK_DOMAIN,
KEYCLOAK_REALM,
)
client = KeycloakAdmin(
server_url=f"https://{KEYCLOAK_DOMAIN}/auth/",
realm_name=KEYCLOAK_REALM,
client_secret_key=KEYCLOAK_CLIENT_SECRET,
verify=True,
)
return client