User Login Search from user key in OIM using UserManager API

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public String getUserLogin(String userKey) {
          String methodName = "getUserLogin";
          logger.setMethodStartLog(className, methodName);
          logger.debug(className, methodName, "userKey: "+userKey);
          String userLogin = null;   
          SearchCriteria sc = new SearchCriteria("usr_key", userKey,Operator.EQUAL); 
          try {
              Set retAttrs = new HashSet();
              retAttrs.add("User Login");// add whatever fields you want get
             
      UserManager usrMgr = Platform.getService(UserManager.class);
     //UserManager usrMgr = OIMClientFactory.getUserManager(); in ADF
              List<oracle.iam.identity.usermgmt.vo.User> userList;
              userList = usrMgr.search(sc, retAttrs, null);
              for(oracle.iam.identity.usermgmt.vo.User user: userList){
                  userLogin =  user.getLogin();//get user fields
                  logger.debug(className, methodName, "userLogin: "+userLogin);
              }
           
           } catch (Exception e) {
              e.printStackTrace();
          }
          logger.debug(className, methodName, "userLogin: "+userLogin);
          logger.setMethodFinishLog(className, methodName);
          return userLogin;
      }

Comments

  1. Can we get reverse? Is there a api to get the user key from the account uid from target?

    ReplyDelete

Post a Comment

Popular posts from this blog

Rules in Sailpoint

Sailpoint Installation Steps (IdentityIQ 7.3 Installation in Windows Machine)

How to create provisioning plan in Sailpoint