[keycloak-user] Credentials on create a new user.

Thiago Leonardo thiagoleocosta at gmail.com
Fri Mar 4 13:37:18 EST 2016


Hi,

I'am trying create a new user in admin-client, but the credentials are not
saved.
The new user is saved normaly. Can you help me ?

My code is:

Keycloak kc = KeycloakBuilder.builder()
.serverUrl("http://localhost:8080/auth")
.realm("Realm")
.username(username)
.password(password)
.clientId("admin-cli")
.resteasyClient( new ResteasyClientBuilder().connectionPoolSize(10).build()
)
.build();

UserRepresentation newUser = new UserRepresentation();
newUser.setUsername(user.getEmail());
newUser.setFirstName(user.getName());
newUser.setEmail(usuario.getEmail());
newUser.setEnabled(true);

CredentialRepresentation credential = new CredentialRepresentation();
credential.setType(CredentialRepresentation.PASSWORD);
credential.setValue(user.getEmail());
credential.setTemporary(true);

newUser.setCredentials(Arrays.asList(credential));
kc.realm("Realm").users().create(newUser);


Regards,

Thiago
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160304/60cfb02d/attachment.html 


More information about the keycloak-user mailing list