keycloak-collective-portal/keycloak_collective_portal/keycloak.py
decentral1se d22abd2bc5
All checks were successful
continuous-integration/drone/push Build is passing
The Big Refactor
Closes #3.
Closes #5.
Closes #7.
Closes #4.
Closes #2.
2021-06-13 12:20:16 +02:00

22 lines
473 B
Python

"""Keycloak logic."""
from keycloak import KeycloakAdmin
def init_keycloak():
"""Initialise Keycloak client."""
from keycloak_collective_portal.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