[keycloak-user] Workaround works

William Drescher [CELUM] William.Drescher at celum.com
Wed Aug 31 08:42:19 EDT 2016


Thanks Sascha works like a charm,

In case it helps someone else this is a simple version of working code (using this as temporary code to set up an initial user, normally would suggest a cleaner way to get the userId from keycloak but search works fine for now):

UserRepresentation user = new UserRepresentation();
user.setUsername("testuser");
user.setFirstName("Test");
user.setLastName("User");
kc.realm("master").users().create(user);
kc.realm("master").users().search("testUser", 0, 1).forEach(
   UserResource userResource = kc.realm("master").users().get(user.getId());
  CredentialRepresentation credential = new CredentialRepresentation();
   credential.setType(CredentialRepresentation.PASSWORD);
   credential.setValue("test123");
   credential.setTemporary(true);
   userResource.resetPassword(credential);
)

Will
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160831/609ef176/attachment.html 


More information about the keycloak-user mailing list