[Download]| [ Documentation Home] | [Release Note]

Remote User Management Sample Guide

INTRODUCTION

In this sample, we demonstrate how to use the remote user management feature to perform user management functionalities from a remote client application. This sample is located in [IdentityServer_Home/Samples/remote-user-mgt]

Often you may find the requirement of adding, deleting and updating users, roles and user profiles that are managed in the user store of Identity Server, through a custom client application of yours rather than performing that functionality through the management console of Identity Server.

Remote User Management feature that is installed into Identity Server by default, facilitates the above requirement and the following section briefly describes this feature and how to use it.

ABOUT REMOTE USER MANAGEMENT

There are two web services APIs that expose the user management functionality in WSO2 carbon.

  1. Remote User Management API: This is recommended to be used by external clients for handling user management of Identity Server.
  2. UserAdmin Service: This is mainly to be used by Carbon UI client.

Using Remote User Management API

From server side, this feature provides set of web services as Admin Services exposing user management functionality. For the client side, it provides an api wrapping the generated client stubs for those web services, to be used in your client code. Since this client API that we provide is for java clients, you can use the wsdls of web services and generate stubs and write custom clients in your preferred language.

Following are the steps for using the remote user management in your client code:

  1. Generate client stubs for AuthenticationAdmin and web service(s) exposing Remote User Management.

    You can access those wsdls from carbon server itself (i.e:https://localhost:9443/services/AuthenticationAdmin?wsdl), by setting "HideAdminServiceWSDLs" property to false in [IdentityServer_Home]/repository/conf/carbon.xml file.

  2. Login to the Identity Server back end as Admin user by calling the "login" method of the stub of AuthenticationAdmin.
  3. Obtain the authentication cookie from the HTTP header of the response sent from carbon server.
  4. Use the above obtained cookie when invoking the AdminServices related to Remote User Management.

You will get a clear understanding about performing above steps if you go through the source code of this sample.

HOW TO BUILD AND RUN THE SAMPLE

To build the samples you need the Apache Ant build tool.

Now follow the simple instructions to build and run the sample:

  1. Run WSO2 Identity Server. See Installation Guide for installation details.
  2. Switch to the remote-user-mgt directory, e.g.
  3. cd CARBON_HOME\samples\remote-user-mgt
  4. From there simply type
  5. ant

    This will build and run the sample. You willl see a

    BUILD SUCCESSFUL
    message after successfully executing this sample.

User Management operations performed in this sample:

This sample performs the following user management operations in the following order:

  1. Add a user given the user name and password.
  2. Add a role given the role name.
  3. Add a user given the user name and password and add user to a role given the role name, at the time of creating the user.
  4. List all existing users in the system.
  5. Delete a user given a user name.

Now you can login to the management console of Identity Server through a web browser and go to 'Configure'->'Users and Roles'->'Users' or 'Roles' and observe the users and roles created by the remote sample client above.