8 Replies Latest reply on Feb 2, 2013 2:49 AM by Trong Tran

    get user encrypted password after saving the user

    Andy Peer Newbie

      Hi, I need to get the user encrypted password stored in gatein table and I use this query:

       

      select TEXT from JBID_IO a join JBID_IO_CREDEN b
                  on a.ID = b.IDENTITY_OBJECT_ID and a.NAME = '<username>' and b.CREDENTIAL_TYPE = 5
      

       

      This query works well when I select the password of a already exsisting user.

      The problem occurs when I create a new user via gatein API:

       

      OrganizationService organizationService = (OrganizationService)PortalContainer.getInstance().getComponentInstanceOfType(OrganizationService.class);
      organizationService.getUserHandler().createUserInstance(username);
      ....
      // other user settings
      ....
      // Deprecated but previuos developers say we need it...
      user.setUserName(username_clean);
      ...
      ....
      organizationService.getUserHandler().createUser(user);
      
      //This method execute the initial query
      String encryptedPw = UsersDAO.getEncyptedPw(username_clean);
      

       

      encryptedPw is null!