[keycloak-user] How to access realms/{realm}/users/{user} with Application

Dean Peterson peterson.dean at gmail.com
Tue Mar 4 14:15:31 EST 2014


I am trying to find the best way to access the UsersResource.java Rest
services outside the keycloak admin application to get a user's
information.  How do I make a request using just the client's credentials?

I currently use something like this but I get a 401 because I am using a
user's oauth token and they only have user privileges:
SkeletonKeySession session = (SkeletonKeySession) request
        ResteasyClient client = new ResteasyClientBuilder()


        String username = request.getRemoteUser();

        Profile profile = null;

        try {

            Response response = client
                            "Bearer " + session.getTokenString()).get();

            // Get the existing entry if there is one. Otherwise, just
            // the regular
            // entity retrieved from the remote system.
            try {
                profile = profileRepository

            } catch (NoResultException e) {
                // ignore

        } finally {

Is there a way for the application to make a request directly as an admin
without giving the user admin privileges?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20140304/061695ca/attachment.html 

More information about the keycloak-user mailing list