000013309 - AxM SDK - Changing a password for a user using the administrative API

Document created by RSA Customer Support Employee on Jun 14, 2016Last modified by RSA Customer Support Employee on Apr 21, 2017
Version 2Show Document
  • View in full screen mode

Article Content

Article Number000013309
Applies ToRSA Access Manager 6.0
RSA Access Manager 6.1
IssueAxM SDK Changing a password for a user using the administrative API
CauseThe SDK provides a java sample program that demonstrates how an end user can update their own password, but there is no example code provided where an administrator is changing the password for the user.

This code demonstrates the two required tasks; firstly,locate the user, and then secondly modify the password value for that user

// com.emc.rsa.mjbond.ct.AdminChangePassword

package com.emc.rsa.mjbond.ct;


import sirrus.connect.ConnectionDescriptor;


import sirrus.api.client.APIServerProxy;

import sirrus.api.client.IUser;

import sirrus.api.client.search.IUserSearch;

import sirrus.api.client.criteria.UserPropertyCriterion;

import sirrus.api.client.criteria.StringCriterion;

import sirrus.api.client.ISparseData;



 * <p>Title: Adding a user to ClearTrust</p>


 * <p>

 * Description: This sample code demonstrates locating anexisting user in CT

 * and updating the password for the user.

 * <br>

 * This code is not supported by RSA in anyway and is supplied 'as is' to demonstate

 * specific behaviour

 * </p>


 * <p>Copyright: Copyright (c) 2011</p>


 * <p>Company: RSA, The Security Division of EMC</p>


 * @author Matthew J Bond

 * @version 1.1


public class AdminChangePassword {

  private static final String ESERVERIP = "";                        // $NON-NLS-1$

  private static final int ESERVERPORT = 5601;

  private static final int ESERVERTIMEOUT = 60000;


  private static final String ADMINUSER = "administrator";                      // $NON-NLS-1$

  private static final String ADMINPW = "passwd01";                             // $NON-NLS-1$

  private static final String ADMINGROUP = "Default Administrative Group";      // $NON-NLS-1$

  private static final String ADMINROLE = "Default Administrative Role";        // $NON-NLS-1$




   * Given a valid eserver authenticated connection and the loginID of a user

   * this method shows a way in which a search mechanism might be used

   * to locate the user and return the IUser object


   * @param proxy APIServerProxy

   * @param userID String

   * @return IUser

   * @throws sirrus.api.client.ObjectNotFoundException

   * @throws sirrus.api.client.TransportException

   * @throws java.io.IOException


  private static IUser getUser(APIServerProxy proxy, String userID) throws






    IUser user = null;

    IUserSearch userSearch = null;

    StringCriterion criterion = null;

    UserPropertyCriterion userCriteria = null;

    ISparseData usersInSearch = null;


    userSearch = proxy.searchUserObjects();

    criterion = new StringCriterion(StringCriterion.EQUALS, userID);

    userCriteria = new UserPropertyCriterion("Name", criterion);                // $NON-NLS-1$


    usersInSearch = userSearch.search();

    user = (IUser) usersInSearch.getByName(userID);

    return user;




   * Supply a single argument as the UserID of the user to be added.  This

   * is then used as userID/first/last values


   * @param args String[]


  public static void main(String[] args) {


    APIServerProxy myServerProxy = null;


    try {

      String userID = args[0];

      String newPassword = args[1];

      IUser user = null;


      // generate the connection details for the EServer

      ConnectionDescriptor eserver =

          new ConnectionDescriptor(ESERVERIP, ESERVERPORT,




      // Estbalisha connection using the preset parameters

      myServerProxy = new APIServerProxy(eserver);


      // Connect to the Entitlements Server as an appropriate administrator

      myServerProxy.connect(ADMINUSER, ADMINPW,




      // Use the static method in this class to search for the user

      user = getUser(myServerProxy,userID);


      // Make the modification to the password



      // Save the modfied user in the Entitlements database.



      System.out.println("User "                                                // $NON-NLS-1$

                         + user.getName() + " updated.");                       // $NON-NLS-1$



    catch (Exception e) {



    finally {

      try {



      catch (Exception ignore) {










Legacy Article IDa53959