[keycloak-user] Impossible to create/assign a user to a group
Marko Strukelj
mstrukel at redhat.com
Thu Sep 14 08:17:12 EDT 2017
It's a separate operation you need to perform in order to add user to a
group, and a separate operation again to set user's password.
Search for it in the archives, it's been asked many times.
Also, consider using Admin CLI (
http://www.keycloak.org/docs/3.3/server_admin/topics/admin-cli.html), which
makes it all much easier.
On Thu, Sep 14, 2017 at 11:47 AM, _ JnMlMe _ <jnmlme at outlook.com> wrote:
> Add missing json content:.
>
>
> group.json:
>
> {
> "name": "THIS-IS-A-SIMPLE-TESTING-GROUP",
> "path": "/THIS-IS-A-SIMPLE-TESTING-GROUP"
> }
>
>
>
> user.json:
>
> {
> "username": "THIS-IS-A-SIMPLE-TESTING-USER",
> "firstName": "firstName",
> "lastName": "lastName",
> "email": "firstName.lastName at noreply.fr",
> "enabled" : true,
> "groups": [
> "/THIS-IS-A-SIMPLE-TESTING-GROUP"
> ],
> "credentials": [
> {
> "type": "password",
> "value": "aaaaaaaa"
> }
> ]
> }
>
>
>
>
>
> ________________________________
> De : keycloak-user-bounces at lists.jboss.org <keycloak-user-bounces at lists.
> jboss.org> de la part de _ JnMlMe _ <jnmlme at outlook.com>
> Envoyé : jeudi 14 septembre 2017 11:34
> À : keycloak-user at lists.jboss.org
> Objet : [keycloak-user] Impossible to create/assign a user to a group
>
> When using admin API (throw curl) to initiliaze via puppet the settings of
> my realms, I didn't manage to both create a user and assigned him to a
> group. The expected user is indeed created but not joined to the expected
> group.
> The API produces no errors in logs. It seems that the groups attribute is
> just ignore.
>
> Tests done on a 3.3.0.CR2 vanilla.
>
> $ curl -X POST -uadmin:admin http://localhost:8080/auth/
> admin/realms/master/groups -H "Content-Type: application/json" -H
> "Authorization: bearer $(curl -s -d "client_id=admin-cli" -d
> "username=admin" -d "password=admin" -d "grant_type=password" "
> http://localhost:8080/auth/realms/master/protocol/openid-connect/token" |
> sed 's/.*access_token":"//g' | sed 's/".*//g')" -d at group.json
>
> $ curl -X POST -uadmin:admin http://localhost:8080/auth/
> admin/realms/master/users -H "Content-Type: application/json" -H
> "Authorization: bearer $(curl -s -d "client_id=admin-cli" -d
> "username=admin" -d "password=admin" -d "grant_type=password" "
> http://localhost:8080/auth/realms/master/protocol/openid-connect/token" |
> sed 's/.*access_token":"//g' | sed 's/".*//g')" -d at user.json
>
> Thks
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>
More information about the keycloak-user
mailing list