|
|
@ -248,7 +248,7 @@ class KeycloakAdmin: |
|
|
|
Import a new realm from a RealmRepresentation. Realm name must be unique. |
|
|
|
|
|
|
|
RealmRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_realmrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_realmrepresentation |
|
|
|
|
|
|
|
:param payload: RealmRepresentation |
|
|
|
|
|
|
@ -264,7 +264,7 @@ class KeycloakAdmin: |
|
|
|
Export the realm configurations in the json format |
|
|
|
|
|
|
|
RealmRepresentation |
|
|
|
https://www.keycloak.org/docs-api/5.0/rest-api/index.html#_partialexport |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_partialexport |
|
|
|
|
|
|
|
:param export-clients: Skip if not want to export realm clients |
|
|
|
:param export-groups-and-roles: Skip if not want to export realm groups and roles |
|
|
@ -289,7 +289,7 @@ class KeycloakAdmin: |
|
|
|
Create a realm |
|
|
|
|
|
|
|
RealmRepresentation: |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_realmrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_realmrepresentation |
|
|
|
|
|
|
|
:param payload: RealmRepresentation |
|
|
|
:param skip_exists: Skip if Realm already exist. |
|
|
@ -306,7 +306,7 @@ class KeycloakAdmin: |
|
|
|
role, or client information in the payload. |
|
|
|
|
|
|
|
RealmRepresentation: |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_realmrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_realmrepresentation |
|
|
|
|
|
|
|
:param realm_name: Realm name (not the realm id) |
|
|
|
:param payload: RealmRepresentation |
|
|
@ -335,7 +335,7 @@ class KeycloakAdmin: |
|
|
|
Return a list of users, filtered according to query parameters |
|
|
|
|
|
|
|
UserRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_userrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_userrepresentation |
|
|
|
|
|
|
|
:param query: Query parameters (optional) |
|
|
|
:return: users list |
|
|
@ -354,7 +354,7 @@ class KeycloakAdmin: |
|
|
|
Create an ID Provider, |
|
|
|
|
|
|
|
IdentityProviderRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_identityproviderrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_identityproviderrepresentation |
|
|
|
|
|
|
|
:param: payload: IdentityProviderRepresentation |
|
|
|
""" |
|
|
@ -368,7 +368,7 @@ class KeycloakAdmin: |
|
|
|
Create an ID Provider, |
|
|
|
|
|
|
|
IdentityProviderRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_identityprovidermapperrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_identityprovidermapperrepresentation |
|
|
|
|
|
|
|
:param: idp_alias: alias for Idp to add mapper in |
|
|
|
:param: payload: IdentityProviderMapperRepresentation |
|
|
@ -383,7 +383,7 @@ class KeycloakAdmin: |
|
|
|
Returns a list of ID Providers, |
|
|
|
|
|
|
|
IdentityProviderRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_identityproviderrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_identityproviderrepresentation |
|
|
|
|
|
|
|
:return: array IdentityProviderRepresentation |
|
|
|
""" |
|
|
@ -406,7 +406,7 @@ class KeycloakAdmin: |
|
|
|
Create a new user. Username must be unique |
|
|
|
|
|
|
|
UserRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_userrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_userrepresentation |
|
|
|
|
|
|
|
:param payload: UserRepresentation |
|
|
|
:param exist_ok: If False, raise KeycloakGetError if username already exists. Otherwise, return existing user ID. |
|
|
@ -443,7 +443,7 @@ class KeycloakAdmin: |
|
|
|
This is required for further actions against this user. |
|
|
|
|
|
|
|
UserRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_userrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_userrepresentation |
|
|
|
|
|
|
|
:param username: id in UserRepresentation |
|
|
|
|
|
|
@ -460,7 +460,7 @@ class KeycloakAdmin: |
|
|
|
:param user_id: User id |
|
|
|
|
|
|
|
UserRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_userrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_userrepresentation |
|
|
|
|
|
|
|
:return: UserRepresentation |
|
|
|
""" |
|
|
@ -511,8 +511,8 @@ class KeycloakAdmin: |
|
|
|
Set up a password for the user. If temporary is True, the user will have to reset |
|
|
|
the temporary password next time they log in. |
|
|
|
|
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/#_users_resource |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/#_credentialrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/#_users_resource |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/#_credentialrepresentation |
|
|
|
|
|
|
|
:param user_id: User id |
|
|
|
:param password: New password |
|
|
@ -531,7 +531,7 @@ class KeycloakAdmin: |
|
|
|
Returns a list of credential belonging to the user. |
|
|
|
|
|
|
|
CredentialRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_credentialrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_credentialrepresentation |
|
|
|
|
|
|
|
:param: user_id: user id |
|
|
|
:return: Keycloak server response (CredentialRepresentation) |
|
|
@ -545,7 +545,7 @@ class KeycloakAdmin: |
|
|
|
Get credential of the user. |
|
|
|
|
|
|
|
CredentialRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_credentialrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_credentialrepresentation |
|
|
|
|
|
|
|
:param: user_id: user id |
|
|
|
:param: credential_id: credential id |
|
|
@ -560,7 +560,7 @@ class KeycloakAdmin: |
|
|
|
Delete credential of the user. |
|
|
|
|
|
|
|
CredentialRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_credentialrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_credentialrepresentation |
|
|
|
|
|
|
|
:param: user_id: user id |
|
|
|
:param: credential_id: credential id |
|
|
@ -574,7 +574,7 @@ class KeycloakAdmin: |
|
|
|
""" |
|
|
|
Logs out user. |
|
|
|
|
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_logout |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_logout |
|
|
|
|
|
|
|
:param user_id: User id |
|
|
|
:return: |
|
|
@ -674,7 +674,7 @@ class KeycloakAdmin: |
|
|
|
:param user_id: id of user |
|
|
|
|
|
|
|
UserSessionRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_usersessionrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_usersessionrepresentation |
|
|
|
|
|
|
|
:return: UserSessionRepresentation |
|
|
|
""" |
|
|
@ -687,7 +687,7 @@ class KeycloakAdmin: |
|
|
|
Get themes, social providers, auth providers, and event listeners available on this server |
|
|
|
|
|
|
|
ServerInfoRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_serverinforepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_serverinforepresentation |
|
|
|
|
|
|
|
:return: ServerInfoRepresentation |
|
|
|
""" |
|
|
@ -699,7 +699,7 @@ class KeycloakAdmin: |
|
|
|
Returns a list of groups belonging to the realm |
|
|
|
|
|
|
|
GroupRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/#_grouprepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/#_grouprepresentation |
|
|
|
|
|
|
|
:return: array GroupRepresentation |
|
|
|
""" |
|
|
@ -717,7 +717,7 @@ class KeycloakAdmin: |
|
|
|
Get group by id. Returns full group details |
|
|
|
|
|
|
|
GroupRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/#_grouprepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/#_grouprepresentation |
|
|
|
|
|
|
|
:param group_id: The group id |
|
|
|
:return: Keycloak server response (GroupRepresentation) |
|
|
@ -731,7 +731,7 @@ class KeycloakAdmin: |
|
|
|
Utility function to iterate through nested group structures |
|
|
|
|
|
|
|
GroupRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/#_grouprepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/#_grouprepresentation |
|
|
|
|
|
|
|
:param name: group (GroupRepresentation) |
|
|
|
:param path: group path (string) |
|
|
@ -755,10 +755,10 @@ class KeycloakAdmin: |
|
|
|
Get members by group id. Returns group members |
|
|
|
|
|
|
|
GroupRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/#_userrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/#_userrepresentation |
|
|
|
|
|
|
|
:param group_id: The group id |
|
|
|
:param query: Additional query parameters (see https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_getmembers) |
|
|
|
:param query: Additional query parameters (see https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_getmembers) |
|
|
|
:return: Keycloak server response (UserRepresentation) |
|
|
|
""" |
|
|
|
params_path = {"realm-name": self.realm_name, "id": group_id} |
|
|
@ -776,7 +776,7 @@ class KeycloakAdmin: |
|
|
|
Subgroups are traversed, the first to match path (or name with path) is returned. |
|
|
|
|
|
|
|
GroupRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/#_grouprepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/#_grouprepresentation |
|
|
|
|
|
|
|
:param path: group path |
|
|
|
:param search_in_subgroups: True if want search in the subgroups |
|
|
@ -807,7 +807,7 @@ class KeycloakAdmin: |
|
|
|
:param skip_exists: If true then do not raise an error if it already exists |
|
|
|
|
|
|
|
GroupRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/#_grouprepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/#_grouprepresentation |
|
|
|
|
|
|
|
:return: Http response |
|
|
|
""" |
|
|
@ -831,7 +831,7 @@ class KeycloakAdmin: |
|
|
|
:param payload: GroupRepresentation with updated information. |
|
|
|
|
|
|
|
GroupRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/#_grouprepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/#_grouprepresentation |
|
|
|
|
|
|
|
:return: Http response |
|
|
|
""" |
|
|
@ -898,7 +898,7 @@ class KeycloakAdmin: |
|
|
|
Returns a list of clients belonging to the realm |
|
|
|
|
|
|
|
ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
|
|
|
|
:return: Keycloak server response (ClientRepresentation) |
|
|
|
""" |
|
|
@ -912,7 +912,7 @@ class KeycloakAdmin: |
|
|
|
Get representation of the client |
|
|
|
|
|
|
|
ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
|
|
|
|
:param client_id: id of client (not client-id) |
|
|
|
:return: Keycloak server response (ClientRepresentation) |
|
|
@ -928,7 +928,7 @@ class KeycloakAdmin: |
|
|
|
This is required for further actions against this client. |
|
|
|
|
|
|
|
:param client_name: name in ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
:return: client_id (uuid as string) |
|
|
|
""" |
|
|
|
|
|
|
@ -945,7 +945,7 @@ class KeycloakAdmin: |
|
|
|
Get authorization json from client. |
|
|
|
|
|
|
|
:param client_id: id in ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
:return: Keycloak server response |
|
|
|
""" |
|
|
|
|
|
|
@ -958,9 +958,9 @@ class KeycloakAdmin: |
|
|
|
Create resources of client. |
|
|
|
|
|
|
|
:param client_id: id in ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
:param payload: ResourceRepresentation |
|
|
|
https://www.keycloak.org/docs-api/12.0/rest-api/index.html#_resourcerepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_resourcerepresentation |
|
|
|
|
|
|
|
:return: Keycloak server response |
|
|
|
""" |
|
|
@ -977,7 +977,7 @@ class KeycloakAdmin: |
|
|
|
Get resources from client. |
|
|
|
|
|
|
|
:param client_id: id in ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
:return: Keycloak server response |
|
|
|
""" |
|
|
|
|
|
|
@ -990,7 +990,7 @@ class KeycloakAdmin: |
|
|
|
Create role-based policy of client. |
|
|
|
|
|
|
|
:param client_id: id in ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
:param payload: No Document |
|
|
|
payload example: |
|
|
|
payload={ |
|
|
@ -1020,9 +1020,9 @@ class KeycloakAdmin: |
|
|
|
Create resource-based permission of client. |
|
|
|
|
|
|
|
:param client_id: id in ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
:param payload: PolicyRepresentation |
|
|
|
https://www.keycloak.org/docs-api/12.0/rest-api/index.html#_policyrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_policyrepresentation |
|
|
|
payload example: |
|
|
|
payload={ |
|
|
|
"type": "resource", |
|
|
@ -1051,7 +1051,7 @@ class KeycloakAdmin: |
|
|
|
Get scopes from client. |
|
|
|
|
|
|
|
:param client_id: id in ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
:return: Keycloak server response |
|
|
|
""" |
|
|
|
|
|
|
@ -1064,7 +1064,7 @@ class KeycloakAdmin: |
|
|
|
Get permissions from client. |
|
|
|
|
|
|
|
:param client_id: id in ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
:return: Keycloak server response |
|
|
|
""" |
|
|
|
|
|
|
@ -1077,7 +1077,7 @@ class KeycloakAdmin: |
|
|
|
Get policies from client. |
|
|
|
|
|
|
|
:param client_id: id in ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
:return: Keycloak server response |
|
|
|
""" |
|
|
|
|
|
|
@ -1090,7 +1090,7 @@ class KeycloakAdmin: |
|
|
|
Get service account user from client. |
|
|
|
|
|
|
|
:param client_id: id in ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
:return: UserRepresentation |
|
|
|
""" |
|
|
|
|
|
|
@ -1102,7 +1102,7 @@ class KeycloakAdmin: |
|
|
|
""" |
|
|
|
Create a client |
|
|
|
|
|
|
|
ClientRepresentation: https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
ClientRepresentation: https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
|
|
|
|
:param skip_exists: If true then do not raise an error if client already exists |
|
|
|
:param payload: ClientRepresentation |
|
|
@ -1133,7 +1133,7 @@ class KeycloakAdmin: |
|
|
|
Get representation of the client |
|
|
|
|
|
|
|
ClientRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_clientrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clientrepresentation |
|
|
|
|
|
|
|
:param client_id: keycloak client id (not oauth client-id) |
|
|
|
:return: Keycloak server response (ClientRepresentation) |
|
|
@ -1148,10 +1148,10 @@ class KeycloakAdmin: |
|
|
|
Get content for given installation provider |
|
|
|
|
|
|
|
Related documentation: |
|
|
|
https://www.keycloak.org/docs-api/5.0/rest-api/index.html#_clients_resource |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clients_resource |
|
|
|
|
|
|
|
Possible provider_id list available in the ServerInfoRepresentation#clientInstallations |
|
|
|
https://www.keycloak.org/docs-api/5.0/rest-api/index.html#_serverinforepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_serverinforepresentation |
|
|
|
|
|
|
|
:param client_id: Client id |
|
|
|
:param provider_id: provider id to specify response format |
|
|
@ -1166,7 +1166,7 @@ class KeycloakAdmin: |
|
|
|
Get all roles for the realm or client |
|
|
|
|
|
|
|
RoleRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_rolerepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_rolerepresentation |
|
|
|
|
|
|
|
:return: Keycloak server response (RoleRepresentation) |
|
|
|
""" |
|
|
@ -1179,7 +1179,7 @@ class KeycloakAdmin: |
|
|
|
""" |
|
|
|
Get role members of realm by role name. |
|
|
|
:param role_name: Name of the role. |
|
|
|
:param query: Additional Query parameters (see https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_roles_resource) |
|
|
|
:param query: Additional Query parameters (see https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_roles_resource) |
|
|
|
:return: Keycloak Server Response (UserRepresentation) |
|
|
|
""" |
|
|
|
params_path = {"realm-name": self.realm_name, "role-name":role_name} |
|
|
@ -1192,7 +1192,7 @@ class KeycloakAdmin: |
|
|
|
:param client_id: id of client (not client-id) |
|
|
|
|
|
|
|
RoleRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_rolerepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_rolerepresentation |
|
|
|
|
|
|
|
:return: Keycloak server response (RoleRepresentation) |
|
|
|
""" |
|
|
@ -1210,7 +1210,7 @@ class KeycloakAdmin: |
|
|
|
:param role_name: role’s name (not id!) |
|
|
|
|
|
|
|
RoleRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_rolerepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_rolerepresentation |
|
|
|
|
|
|
|
:return: role_id |
|
|
|
""" |
|
|
@ -1229,7 +1229,7 @@ class KeycloakAdmin: |
|
|
|
:param role_name: role’s name (not id!) |
|
|
|
|
|
|
|
RoleRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_rolerepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_rolerepresentation |
|
|
|
|
|
|
|
:return: role_id |
|
|
|
""" |
|
|
@ -1241,7 +1241,7 @@ class KeycloakAdmin: |
|
|
|
Create a client role |
|
|
|
|
|
|
|
RoleRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_rolerepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_rolerepresentation |
|
|
|
|
|
|
|
:param client_role_id: id of client (not client-id) |
|
|
|
:param payload: RoleRepresentation |
|
|
@ -1275,7 +1275,7 @@ class KeycloakAdmin: |
|
|
|
Delete a client role |
|
|
|
|
|
|
|
RoleRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_rolerepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_rolerepresentation |
|
|
|
|
|
|
|
:param client_role_id: id of client (not client-id) |
|
|
|
:param role_name: role’s name (not id!) |
|
|
@ -1305,7 +1305,7 @@ class KeycloakAdmin: |
|
|
|
Get members by client role . |
|
|
|
:param client_id: The client id |
|
|
|
:param role_name: the name of role to be queried. |
|
|
|
:param query: Additional query parameters ( see https://www.keycloak.org/docs-api/11.0/rest-api/index.html#_clients_resource) |
|
|
|
:param query: Additional query parameters ( see https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_clients_resource) |
|
|
|
:return: Keycloak server response (UserRepresentation) |
|
|
|
""" |
|
|
|
params_path = {"realm-name": self.realm_name, "id":client_id, "role-name":role_name} |
|
|
@ -1332,7 +1332,7 @@ class KeycloakAdmin: |
|
|
|
:param role_name: role's name, not id! |
|
|
|
|
|
|
|
RoleRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_rolerepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_rolerepresentation |
|
|
|
:return: role_id |
|
|
|
""" |
|
|
|
params_path = {"realm-name": self.realm_name, "role-name": role_name} |
|
|
@ -1614,7 +1614,7 @@ class KeycloakAdmin: |
|
|
|
Get authentication flows. Returns all flow details |
|
|
|
|
|
|
|
AuthenticationFlowRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authenticationflowrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authenticationflowrepresentation |
|
|
|
|
|
|
|
:return: Keycloak server response (AuthenticationFlowRepresentation) |
|
|
|
""" |
|
|
@ -1627,7 +1627,7 @@ class KeycloakAdmin: |
|
|
|
Get one authentication flow by it's id/alias. Returns all flow details |
|
|
|
|
|
|
|
AuthenticationFlowRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authenticationflowrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authenticationflowrepresentation |
|
|
|
|
|
|
|
:param flow_id: the id of a flow NOT it's alias |
|
|
|
:return: Keycloak server response (AuthenticationFlowRepresentation) |
|
|
@ -1641,7 +1641,7 @@ class KeycloakAdmin: |
|
|
|
Create a new authentication flow |
|
|
|
|
|
|
|
AuthenticationFlowRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authenticationflowrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authenticationflowrepresentation |
|
|
|
|
|
|
|
:param payload: AuthenticationFlowRepresentation |
|
|
|
:param skip_exists: If true then do not raise an error if authentication flow already exists |
|
|
@ -1672,7 +1672,7 @@ class KeycloakAdmin: |
|
|
|
Delete authentication flow |
|
|
|
|
|
|
|
AuthenticationInfoRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authenticationinforepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authenticationinforepresentation |
|
|
|
|
|
|
|
:param flow_id: authentication flow id |
|
|
|
:return: Keycloak server response |
|
|
@ -1697,7 +1697,7 @@ class KeycloakAdmin: |
|
|
|
Update an authentication flow execution |
|
|
|
|
|
|
|
AuthenticationExecutionInfoRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authenticationexecutioninforepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authenticationexecutioninforepresentation |
|
|
|
|
|
|
|
:param payload: AuthenticationExecutionInfoRepresentation |
|
|
|
:param flow_alias: The flow alias |
|
|
@ -1714,7 +1714,7 @@ class KeycloakAdmin: |
|
|
|
Get authentication flow execution. |
|
|
|
|
|
|
|
AuthenticationExecutionInfoRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authenticationexecutioninforepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authenticationexecutioninforepresentation |
|
|
|
|
|
|
|
:param execution_id: the execution ID |
|
|
|
:return: Response(json) |
|
|
@ -1728,7 +1728,7 @@ class KeycloakAdmin: |
|
|
|
Create an authentication flow execution |
|
|
|
|
|
|
|
AuthenticationExecutionInfoRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authenticationexecutioninforepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authenticationexecutioninforepresentation |
|
|
|
|
|
|
|
:param payload: AuthenticationExecutionInfoRepresentation |
|
|
|
:param flow_alias: The flow alias |
|
|
@ -1745,7 +1745,7 @@ class KeycloakAdmin: |
|
|
|
Delete authentication flow execution |
|
|
|
|
|
|
|
AuthenticationExecutionInfoRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authenticationexecutioninforepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authenticationexecutioninforepresentation |
|
|
|
|
|
|
|
:param execution_id: keycloak client id (not oauth client-id) |
|
|
|
:return: Keycloak server response (json) |
|
|
@ -1759,7 +1759,7 @@ class KeycloakAdmin: |
|
|
|
Create a new sub authentication flow for a given authentication flow |
|
|
|
|
|
|
|
AuthenticationFlowRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authenticationflowrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authenticationflowrepresentation |
|
|
|
|
|
|
|
:param payload: AuthenticationFlowRepresentation |
|
|
|
:param flow_alias: The flow alias |
|
|
@ -1788,7 +1788,7 @@ class KeycloakAdmin: |
|
|
|
Update an authenticator configuration. |
|
|
|
|
|
|
|
AuthenticatorConfigRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authenticatorconfigrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authenticatorconfigrepresentation |
|
|
|
|
|
|
|
:param payload: AuthenticatorConfigRepresentation |
|
|
|
:param config_id: Authenticator config id |
|
|
@ -1802,7 +1802,7 @@ class KeycloakAdmin: |
|
|
|
def delete_authenticator_config(self, config_id): |
|
|
|
""" |
|
|
|
Delete a authenticator configuration. |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_authentication_management_resource |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_authentication_management_resource |
|
|
|
|
|
|
|
:param config_id: Authenticator config id |
|
|
|
:return: Keycloak server Response |
|
|
@ -1832,7 +1832,7 @@ class KeycloakAdmin: |
|
|
|
def get_client_scopes(self): |
|
|
|
""" |
|
|
|
Get representation of the client scopes for the realm where we are connected to |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_getclientscopes |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_getclientscopes |
|
|
|
|
|
|
|
:return: Keycloak server response Array of (ClientScopeRepresentation) |
|
|
|
""" |
|
|
@ -1844,7 +1844,7 @@ class KeycloakAdmin: |
|
|
|
def get_client_scope(self, client_scope_id): |
|
|
|
""" |
|
|
|
Get representation of the client scopes for the realm where we are connected to |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_getclientscopes |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_getclientscopes |
|
|
|
|
|
|
|
:param client_scope_id: The id of the client scope |
|
|
|
:return: Keycloak server response (ClientScopeRepresentation) |
|
|
@ -1858,7 +1858,7 @@ class KeycloakAdmin: |
|
|
|
""" |
|
|
|
Create a client scope |
|
|
|
|
|
|
|
ClientScopeRepresentation: https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_getclientscopes |
|
|
|
ClientScopeRepresentation: https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_getclientscopes |
|
|
|
|
|
|
|
:param payload: ClientScopeRepresentation |
|
|
|
:param skip_exists: If true then do not raise an error if client scope already exists |
|
|
@ -1874,7 +1874,7 @@ class KeycloakAdmin: |
|
|
|
""" |
|
|
|
Update a client scope |
|
|
|
|
|
|
|
ClientScopeRepresentation: https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_client_scopes_resource |
|
|
|
ClientScopeRepresentation: https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_client_scopes_resource |
|
|
|
|
|
|
|
:param client_scope_id: The id of the client scope |
|
|
|
:param payload: ClientScopeRepresentation |
|
|
@ -1889,7 +1889,7 @@ class KeycloakAdmin: |
|
|
|
def add_mapper_to_client_scope(self, client_scope_id, payload): |
|
|
|
""" |
|
|
|
Add a mapper to a client scope |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_create_mapper |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_create_mapper |
|
|
|
|
|
|
|
:param client_scope_id: The id of the client scope |
|
|
|
:param payload: ProtocolMapperRepresentation |
|
|
@ -1906,7 +1906,7 @@ class KeycloakAdmin: |
|
|
|
def delete_mapper_from_client_scope(self, client_scope_id, protocol_mppaer_id): |
|
|
|
""" |
|
|
|
Delete a mapper from a client scope |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_delete_mapper |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_delete_mapper |
|
|
|
|
|
|
|
:param client_scope_id: The id of the client scope |
|
|
|
:param payload: ProtocolMapperRepresentation |
|
|
@ -1924,7 +1924,7 @@ class KeycloakAdmin: |
|
|
|
def update_mapper_in_client_scope(self, client_scope_id, protocol_mapper_id, payload): |
|
|
|
""" |
|
|
|
Update an existing protocol mapper in a client scope |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_protocol_mappers_resource |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_protocol_mappers_resource |
|
|
|
|
|
|
|
:param client_scope_id: The id of the client scope |
|
|
|
:param protocol_mapper_id: The id of the protocol mapper which exists in the client scope |
|
|
@ -2016,7 +2016,7 @@ class KeycloakAdmin: |
|
|
|
def add_mapper_to_client(self, client_id, payload): |
|
|
|
""" |
|
|
|
Add a mapper to a client |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_create_mapper |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_create_mapper |
|
|
|
|
|
|
|
:param client_id: The id of the client |
|
|
|
:param payload: ProtocolMapperRepresentation |
|
|
@ -2053,7 +2053,7 @@ class KeycloakAdmin: |
|
|
|
def remove_client_mapper(self, client_id, client_mapper_id): |
|
|
|
""" |
|
|
|
Removes a mapper from the client |
|
|
|
https://www.keycloak.org/docs-api/15.0/rest-api/index.html#_protocol_mappers_resource |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_protocol_mappers_resource |
|
|
|
:param client_id: The id of the client |
|
|
|
:param client_mapper_id: The id of the mapper to be deleted |
|
|
|
:return: Keycloak server response |
|
|
@ -2074,7 +2074,7 @@ class KeycloakAdmin: |
|
|
|
""" |
|
|
|
|
|
|
|
Generate a new secret for the client |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_regeneratesecret |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_regeneratesecret |
|
|
|
|
|
|
|
:param client_id: id of client (not client-id) |
|
|
|
:return: Keycloak server response (ClientRepresentation) |
|
|
@ -2088,7 +2088,7 @@ class KeycloakAdmin: |
|
|
|
""" |
|
|
|
|
|
|
|
Get representation of the client secrets |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_getclientsecret |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_getclientsecret |
|
|
|
|
|
|
|
:param client_id: id of client (not client-id) |
|
|
|
:return: Keycloak server response (ClientRepresentation) |
|
|
@ -2103,7 +2103,7 @@ class KeycloakAdmin: |
|
|
|
Return a list of components, filtered according to query parameters |
|
|
|
|
|
|
|
ComponentRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_componentrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_componentrepresentation |
|
|
|
|
|
|
|
:param query: Query parameters (optional) |
|
|
|
:return: components list |
|
|
@ -2118,7 +2118,7 @@ class KeycloakAdmin: |
|
|
|
Create a new component. |
|
|
|
|
|
|
|
ComponentRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_componentrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_componentrepresentation |
|
|
|
|
|
|
|
:param payload: ComponentRepresentation |
|
|
|
|
|
|
@ -2137,7 +2137,7 @@ class KeycloakAdmin: |
|
|
|
:param component_id: Component id |
|
|
|
|
|
|
|
ComponentRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_componentrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_componentrepresentation |
|
|
|
|
|
|
|
:return: ComponentRepresentation |
|
|
|
""" |
|
|
@ -2151,7 +2151,7 @@ class KeycloakAdmin: |
|
|
|
|
|
|
|
:param component_id: Component id |
|
|
|
:param payload: ComponentRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_componentrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_componentrepresentation |
|
|
|
|
|
|
|
:return: Http response |
|
|
|
""" |
|
|
@ -2177,7 +2177,7 @@ class KeycloakAdmin: |
|
|
|
Return a list of keys, filtered according to query parameters |
|
|
|
|
|
|
|
KeysMetadataRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_key_resource |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_key_resource |
|
|
|
|
|
|
|
:return: keys list |
|
|
|
""" |
|
|
@ -2191,7 +2191,7 @@ class KeycloakAdmin: |
|
|
|
Return a list of events, filtered according to query parameters |
|
|
|
|
|
|
|
EventRepresentation array |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_eventrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_eventrepresentation |
|
|
|
|
|
|
|
:return: events list |
|
|
|
""" |
|
|
@ -2205,7 +2205,7 @@ class KeycloakAdmin: |
|
|
|
Set realm events configuration |
|
|
|
|
|
|
|
RealmEventsConfigRepresentation |
|
|
|
https://www.keycloak.org/docs-api/8.0/rest-api/index.html#_realmeventsconfigrepresentation |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_realmeventsconfigrepresentation |
|
|
|
|
|
|
|
:return: Http response |
|
|
|
""" |
|
|
@ -2332,7 +2332,7 @@ class KeycloakAdmin: |
|
|
|
:param client_id: id of client |
|
|
|
|
|
|
|
UserSessionRepresentation |
|
|
|
http://www.keycloak.org/docs-api/3.3/rest-api/index.html#_usersessionrepresentation |
|
|
|
http://www.keycloak.org/docs-api/17.0/rest-api/index.html#_usersessionrepresentation |
|
|
|
|
|
|
|
:return: UserSessionRepresentation |
|
|
|
""" |
|
|
@ -2355,7 +2355,7 @@ class KeycloakAdmin: |
|
|
|
""" |
|
|
|
Get current session count for all clients with active sessions |
|
|
|
|
|
|
|
https://www.keycloak.org/docs-api/16.1/rest-api/index.html#_getclientsessionstats |
|
|
|
https://www.keycloak.org/docs-api/17.0/rest-api/index.html#_getclientsessionstats |
|
|
|
|
|
|
|
:return: Dict of clients and session count |
|
|
|
""" |
|
|
|