Package org.keycloak.tests.utils.admin
Class ApiUtil
java.lang.Object
org.keycloak.tests.utils.admin.ApiUtil
- Author:
- Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassignClientRoles(RealmResource realm, String userId, String clientName, String... roles) static voidassignRealmRoles(RealmResource realm, String userId, String... roles) static StringcreateUserAndResetPasswordWithAdminClient(RealmResource realm, org.keycloak.representations.idm.UserRepresentation user, String password) Creates a user and sets the passwordstatic StringcreateUserAndResetPasswordWithAdminClient(RealmResource realm, org.keycloak.representations.idm.UserRepresentation user, String password, boolean temporary) Creates a user and sets the passwordstatic StringcreateUserWithAdminClient(RealmResource realm, org.keycloak.representations.idm.UserRepresentation user) Creates a userstatic AuthorizationResourcefindAuthorizationSettings(RealmResource realm, String clientId) static ClientResourcefindClientByClientId(RealmResource realm, String clientId) static ClientResourcefindClientResourceById(RealmResource realm, String id) static ClientResourcefindClientResourceByName(RealmResource realm, String name) static RoleResourcefindClientRoleByName(ClientResource client, String role) static ClientScopeResourcefindClientScopeByName(RealmResource realm, String clientScopeName) static org.keycloak.representations.idm.ProtocolMapperRepresentationfindProtocolMapperByName(ClientResource client, String name) static org.keycloak.representations.idm.ProtocolMapperRepresentationfindProtocolMapperByName(ClientScopeResource scope, String name) static RoleResourcefindRealmRoleByName(RealmResource realm, String role) static org.keycloak.representations.idm.UserRepresentationfindUserByUsername(RealmResource realm, String username) static UserResourcefindUserByUsernameId(RealmResource realm, String username) static StringgetCreatedId(jakarta.ws.rs.core.Response response) static booleangroupContainsSubgroup(GroupResource groupsResource, org.keycloak.representations.idm.GroupRepresentation subgroup) static voidremoveUserByUsername(RealmResource realmResource, String username) static voidresetUserPassword(UserResource userResource, String newPassword, boolean temporary) static voidupdateRequiredActionsOrder(RealmResource realmResource, List<org.keycloak.models.UserModel.RequiredAction> requiredActionsInTargetOrder) Updates the order of required actionsstatic voidupdateRequiredActionsOrderByAlias(RealmResource realmResource, List<String> requiredActionsInTargetOrder)
-
Constructor Details
-
ApiUtil
public ApiUtil()
-
-
Method Details
-
getCreatedId
-
findClientResourceById
-
findClientResourceByName
-
findClientByClientId
-
findClientRoleByName
-
findProtocolMapperByName
public static org.keycloak.representations.idm.ProtocolMapperRepresentation findProtocolMapperByName(ClientResource client, String name) -
findProtocolMapperByName
public static org.keycloak.representations.idm.ProtocolMapperRepresentation findProtocolMapperByName(ClientScopeResource scope, String name) -
findClientScopeByName
public static ClientScopeResource findClientScopeByName(RealmResource realm, String clientScopeName) -
findRealmRoleByName
-
findUserByUsername
public static org.keycloak.representations.idm.UserRepresentation findUserByUsername(RealmResource realm, String username) -
findUserByUsernameId
-
createUserWithAdminClient
public static String createUserWithAdminClient(RealmResource realm, org.keycloak.representations.idm.UserRepresentation user) Creates a user- Parameters:
realm-user-- Returns:
- ID of the new user
-
createUserAndResetPasswordWithAdminClient
public static String createUserAndResetPasswordWithAdminClient(RealmResource realm, org.keycloak.representations.idm.UserRepresentation user, String password) Creates a user and sets the password- Parameters:
realm-user-password-- Returns:
- ID of the new user
-
createUserAndResetPasswordWithAdminClient
public static String createUserAndResetPasswordWithAdminClient(RealmResource realm, org.keycloak.representations.idm.UserRepresentation user, String password, boolean temporary) Creates a user and sets the password- Parameters:
realm-user-password-temporary-- Returns:
- ID of the new user
-
resetUserPassword
public static void resetUserPassword(UserResource userResource, String newPassword, boolean temporary) -
assignRealmRoles
-
removeUserByUsername
-
assignClientRoles
public static void assignClientRoles(RealmResource realm, String userId, String clientName, String... roles) -
groupContainsSubgroup
public static boolean groupContainsSubgroup(GroupResource groupsResource, org.keycloak.representations.idm.GroupRepresentation subgroup) -
findAuthorizationSettings
-
updateRequiredActionsOrder
public static void updateRequiredActionsOrder(RealmResource realmResource, List<org.keycloak.models.UserModel.RequiredAction> requiredActionsInTargetOrder) Updates the order of required actions- Parameters:
realmResource- the realmrequiredActionsInTargetOrder- the required actions for which the order should be changed (order will be the order of this list) - can be a subset of the available required actions- See Also:
-
updateRequiredActionsOrderByAlias
public static void updateRequiredActionsOrderByAlias(RealmResource realmResource, List<String> requiredActionsInTargetOrder)
-