Hi all,
Please, need some help! I'm trying to create an user through Keycloak Admin
Client.
So, When I add an user from Keycloak register page my LDAP stores a tag
called "userPassword" with the password stored.
But When I add an user from Keycloak Admin Client, all informations are
stored in LDAP, except "userPassword". Am I doing something wrong?
Here is my code below:
public Response createUserKeycloak(UserKeycloak userKeycloak) {
CredentialRepresentation credential = new
CredentialRepresentation();
credential.setType(CredentialRepresentation.PASSWORD);
credential.setValue(userKeycloak.getPassword());
credential.setTemporary(false);
UserRepresentation user = new UserRepresentation();
user.setUsername(userKeycloak.getUsername());
user.setFirstName(userKeycloak.getFirstName());
user.setLastName(userKeycloak.getLastName());
user.setEnabled(true);
if (userKeycloak.getEmail() != null)
user.setEmail(userKeycloak.getEmail());
user.setCredentials(Arrays.asList(credential));
RealmResource realmResource =
keycloak.realm(realmProperties.getRealm());
UsersResource userRessource = realmResource.users();
return userRessource.create(user);
}
Best Regards,
--
---
*Celso Agra*