[keycloak-user] Is it possible to update users with the admin client

Alexander Chriztopher alexander.chriztopher at gmail.com
Fri Dec 19 13:36:05 EST 2014


Hi,

I would like to use the admin client to update a user in order to force him
to change his password next time he logs in ?

So far i have failed miserably to do it so i was wondering if this is at
all possible ?

This is basically what am doing :

        Keycloak keycloak = Keycloak.getInstance(authServer, "example",
"examples-admin-client", "password", "examples-admin-client", "password");
        RealmResource realm = keycloak.realm("example");
        UsersResource users = realm.users();
        List<UserRepresentation> users_ = users.search("", 0, 1000000); //
This gets me all my users
        for (UserRepresentation user_ : users_) {
            if (user_.getUsername().equals("examples-admin-client")) {
                user_.setEmailVerified(true);
            }
        }
        RealmRepresentation realm_ = realm.toRepresentation();
        realm_.setUsers(users_);
        realm.update(realm_);

Does the method update of realm support users update ?

Thanks for any help on this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20141219/f727a966/attachment.html 


More information about the keycloak-user mailing list