Example #1
0
    def get(self, request, *args, **kwargs):
        keycloak_admin = KeycloakAdmin(
            server_url=admin_config['KEYCLOAK_SERVER_URL'],
            username=admin_config['KEYCLOAK_USERNAME'],
            password=admin_config['KEYCLOAK_PASSWORD'],
            realm_name=admin_config['KEYCLOAK_REALM'],
            verify=True)

        try:
            applications = keycloak_admin.get_clients()
            return response.Response(applications, status=status.HTTP_200_OK)
        except KeycloakError as e:
            print(e.__class__)
            return keycloak_error_response(e)
Example #2
0
# Send User Action
response = keycloak_admin.send_update_account(user_id="user-id-keycloak", 
                                              payload=json.dumps(['UPDATE_PASSWORD']))

# Send Verify Email
response = keycloak_admin.send_verify_email(user_id="user-id-keycloak")

# Get sessions associated with the user
sessions = keycloak_admin.get_sessions(user_id="user-id-keycloak")

# Get themes, social providers, auth providers, and event listeners available on this server
server_info = keycloak_admin.get_server_info()

# Get clients belonging to the realm Returns a list of clients belonging to the realm
clients = keycloak_admin.get_clients()

# Get client - id (not client-id) from client by name
client_id=keycloak_admin.get_client_id("my-client")

# Get representation of the client - id of client (not client-id)
client = keycloak_admin.get_client(client_id="client_id")

# Get all roles for the realm or client
realm_roles = keycloak_admin.get_realm_roles()

# Get all roles for the client
client_roles = keycloak_admin.get_client_roles(client_id="client_id")

# Get client role
role = keycloak_admin.get_client_role(client_id="client_id", role_name="role_name")