[keycloak-user] user credential and role pro grammatically

yassine yas nizar2yas at gmail.com
Wed Aug 31 09:26:30 EDT 2016


Hi,
 I'm creating users programmatically from my java code,but the users
credential and roles are note "persisted" (I think), when the user try to
authenticate he get *Invalid username or password (*even if he is visible
in the admin console), If I define (from the admin console) a passe Word
for the user and use it he can access his account, but here come the 2
problem, even if I give him the right (role) to use a resource he gets
forbidden.
here is the code that I use to define users credential and role :

       * CredentialRepresentation credential = new
CredentialRepresentation();*
*        credential.setType(CredentialRepresentation.PASSWORD);
   *
*        credential.setValue("123");
                        *

*  user.setCredentials(Arrays.asList(credential));
                *

*   user.setRealmRoles(Arrays.asList("guest"));
             *

Cordially
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160831/ec84aa48/attachment-0001.html 


More information about the keycloak-user mailing list