Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

You can learn more about the admin services used in this sample by referring Calling Admin Services, Managing Users and Roles with APIs and Managing Permissions with APIs.

  1. Create a folder in your local machine and navigate to it using your command line.
  2. Download the Java sample from GitHub from the link below. Follow these instructions to checkout the samples folder. Go to user-mgt/remote-user-mgt. The location of this folder (is-samplesThe code for the sample can be checked out from the GitHub repository. To do this, follow the instructions on the Downloading a Sample topic.
  3. Once downloaded the identity server samples, go inside to IS_SAMPLES/modules/samples/user-mgt/remote-user-mgt) will be referred to as <remote-user-mgt_HOME> from this point onwards.

  4. Open the <remote-user-mgt_HOME>/build.xml file and update the ${wso2is.home} value with your IS home. Do this by modifying the wso2is.home property in a manner similar to the following.

    Code Block
    languagexml
    <property name="wso2is.home" value="/Users/Sam/Documents/IS/SampleTest/wso2is-5.3.0/"/>
  5. Update the RemoteUMSampleConstants.java file located in is-samples directory to build the remote user management cliant.

  6. Make sure the URL of the remote server (remote.server.url), credentials of the user who performs user management operations (user.name, user.password) and truststore (truststore.path, truststore.password) configured in IS_SAMPLES/modules/samples/user-mgt/remote-user-mgt/src/main/java/org/wso2/remoteum/sample with the directory that your WSO2 Identity Server instance is located. For example, the code will look similar to the following.

    Code Block
    languagejava
    public static final String IS_HOME ="/Users/Sam/Documents/IS/SampleTest/wso2is-5.3.0/";
  7. Start the Identity Server using the start up script found in the <IS_HOME>/bin directory.
    • Use wso2server.sh for Linux.
    • Use wso2server.bat for Windows.
    Note

    Note: Ensure that the port offset in the <IS_Home>/repository/conf/carbon.xml file is set at 0

  8. Download and install Apache Ant if you have not already done so.
  9. Modify the <remote-user-mgt_HOME>/client.properties file if the default configuration to run the sample is different. For example, if you have changed the password for your user, you need to update it here.
  10. Open a command line interface and navigate to the <remote-user-mgt_HOME> directory.
  11. Run the ant command at this directory level in the command line and observe the different user management operations performed remotely. In a successful run, you will see following logs,
    Image Removed
  12. Log in to the Identity Server and go to Users and Roles in the Configure menu in the management console
  13. Click Users and you can now view the users created in the list using the sample.

    client.propeties are correct with respect to your environment. If you have changed the private key in the identity server, import the public certificate of the identity server to truststore (client-truststore.jks) of the sample client in IS_SAMPLES/modules/samples/user-mgt/remote-user-mgt/src/main/resources/keystore.

  14. Build the client using mvn install.

  15. Once the client is built successfully, run the remote-user-mgt-client.sh file in Unix or remote-user-mgt-client.bat in Windows. You can see that the issues performed is being printed by the client.
    Image Added

Note

Note: The service stubs are available at WSO2 Maven Repository and can be added as dependencies to the project. Also, you can generate the service stubs from the WSDL file available at https://localhost:9443/services/<ServiceName>?wsdl

In order to access the WSDL file, update the following configuration in the <IS_HOME>/repository/conf/carbon.xml file.

Code Block
languagexml
<HideAdminServiceWSDLs>false</HideAdminServiceWSDLs>