Browse Source

Add support for Client Credentials Grant in KeycloakAdmin

pull/71/head
Romain Philibert 5 years ago
parent
commit
43a7a3943b
  1. 8
      docs/source/index.rst
  2. 2
      keycloak/keycloak_admin.py

8
docs/source/index.rst

@ -158,6 +158,14 @@ Main methods::
# realm_name="example_realm", # realm_name="example_realm",
# verify=True, # verify=True,
# custom_headers={'CustomHeader': 'value'}) # custom_headers={'CustomHeader': 'value'})
#
# You can also authenticate with client_id and client_secret
#keycloak_admin = KeycloakAdmin(server_url="http://localhost:8080/auth/",
# client_id="example_client",
# client_secret_key="secret",
# realm_name="example_realm",
# verify=True,
# custom_headers={'CustomHeader': 'value'})
# Add user # Add user
new_user = keycloak_admin.create_user({"email": "example@example.com", new_user = keycloak_admin.create_user({"email": "example@example.com",

2
keycloak/keycloak_admin.py

@ -60,7 +60,7 @@ class KeycloakAdmin:
_custom_headers = None _custom_headers = None
_user_realm_name = None _user_realm_name = None
def __init__(self, server_url, username, password, realm_name='master', client_id='admin-cli', verify=True,
def __init__(self, server_url, username=None, password=None, realm_name='master', client_id='admin-cli', verify=True,
client_secret_key=None, custom_headers=None, user_realm_name=None, auto_refresh_token=None): client_secret_key=None, custom_headers=None, user_realm_name=None, auto_refresh_token=None):
""" """

Loading…
Cancel
Save