[keycloak-user] user credential and role pro grammatically

Marek Posolda mposolda at redhat.com
Tue Sep 6 02:40:08 EDT 2016


You need to use separate endpoints for update credentials and separate 
endpoint for update roles. For example see our testsuite 
https://github.com/keycloak/keycloak/blob/master/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/UserTest.java

Marek

On 31/08/16 15:26, yassine yas wrote:
> 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
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160906/ada08909/attachment.html 


More information about the keycloak-user mailing list