Examples of UserDataVO


Examples of org.ejbca.core.model.ra.UserDataVO

            String username = args[1];
            int reason = Integer.parseInt(args[2]);
            if ((reason == 7) || (reason < 0) || (reason > 10)) {
              getLogger().error("Reason must be an integer between 0 and 10 except 7.");
            } else {
                UserDataVO data = ejb.getUserAdminSession().findUser(getAdmin(), username);
                if (data==null) {
                  getLogger().error("User not found.");
                  return;
                }
                getLogger().info("Found user:");
                getLogger().info("username=" + data.getUsername());
                getLogger().info("dn=\"" + data.getDN() + "\"");
                getLogger().info("Old status=" + data.getStatus());
                // Revoke users certificates
                try {
                    ejb.getUserAdminSession().revokeUser(getAdmin(), username, reason);
                    data = ejb.getUserAdminSession().findUser(getAdmin(), username);
                    getLogger().info("New status=" + data.getStatus());
                } catch (AuthorizationDeniedException e) {
                  getLogger().error("Not authorized to revoke user.");
                } catch (ApprovalException e) {
                  getLogger().error("Revocation already requested.");
                } catch (WaitingForApprovalException e) {
View Full Code Here

Examples of org.ejbca.core.model.ra.UserDataVO

          if (log.isDebugEnabled()) {
            log.debug("userAdminSession.query returned " + userDatas.size() + " results for query \"" + query.getQueryString() + "\"");
          }
          Iterator<UserDataVO> userIter = userDatas.iterator();
          while(userIter.hasNext() && retval.size() <= resSize){
            UserDataVO nextUser = userIter.next();
            // Find all the certificates of the matching users
            try {
              Collection<Certificate> userCerts = certificateStoreSession.findCertificatesByUsername(pubAdmin, nextUser.getUsername());
              if (log.isDebugEnabled()) {
                log.debug("certificateStoreSession.findCertificatesByUsername " + userCerts.size() + " results for user \"" + nextUser.getUsername() + "\"");
              }
              // For all the certificates
              Iterator<Certificate> userCertIter = userCerts.iterator();
              while(userCertIter.hasNext() &&  retval.size() <= resSize){
                X509Certificate nextCert = (X509Certificate) userCertIter.next();                       
View Full Code Here

Examples of org.ejbca.core.model.ra.UserDataVO

      if(resultMajor == null){        
        if(resultMajor == null){
          X509Certificate cert = (X509Certificate) getPublicKeyInfo(req, false);         
         
          UserDataVO userData = findUserData(cert);
          if(userData != null){
            String password = ""
            boolean encryptedPassword = isPasswordEncrypted(req);
            if(encryptedPassword){
              password = getEncryptedPassword(requestDoc, userData.getPassword());
            }else{
              password = getClearPassword(req, userData.getPassword());
            }

            if(password != null ){
              X509Certificate newCert = registerReissueOrRecover(true,false, result, userData,password,  cert.getPublicKey(), null);
              if(newCert != null){
View Full Code Here

Examples of org.ejbca.core.model.ra.UserDataVO

              getLogger().error("SubjectDN must be supplied.");
              return;
            }
            getLogger().info("Setting subjectDN '" + subjectDN + "' for user " + username);
            try {
              UserDataVO uservo = ejb.getUserAdminSession().findUser(getAdmin(), username);
              uservo.setDN(subjectDN);
              ejb.getUserAdminSession().changeUser(getAdmin(), uservo, false);
            } catch (AuthorizationDeniedException e) {
              getLogger().error("Not authorized to change userdata.");
            } catch (UserDoesntFullfillEndEntityProfile e) {
              getLogger().error("Given userdata doesn't fullfill end entity profile. : " + e.getMessage());
View Full Code Here

Examples of org.ejbca.core.model.ra.UserDataVO

        }  
        if(ejb.getKeyRecoverySession().isUserMarked(getAdmin(),username)){
          getLogger().error("User is already marked for recovery.");
          return;                    
        }
        UserDataVO userdata = ejb.getUserAdminSession().findUser(getAdmin(), username);
        if(userdata == null){
          getLogger().error("The user doesn't exist.");
          return;
        }
        if (ejb.getUserAdminSession().prepareForKeyRecovery(getAdmin(), userdata.getUsername(), userdata.getEndEntityProfileId(), null)) {
            getLogger().info("Key corresponding to users newest certificate has been marked for recovery.");            
        } else {
            getLogger().info("Failed to mark key corresponding to users newest certificate for recovery.");            
        }
      } catch (Exception e) {
View Full Code Here

Examples of org.ejbca.core.model.ra.UserDataVO

            } else {
                coll = ejb.getUserAdminSession().findAllUsersByStatus(getAdmin(), status);
            }
            Iterator<UserDataVO> iter = coll.iterator();
            while (iter.hasNext()) {
                UserDataVO data = iter.next();
                getLogger().info("User: " + data.getUsername() + ", \"" + data.getDN() +
                    "\", \"" + data.getSubjectAltName() + "\", " + data.getEmail() + ", " +
                    data.getStatus() + ", " + data.getType() + ", " + data.getTokenType() + ", " + data.getHardTokenIssuerId());
            }
        } catch (Exception e) {
            throw new ErrorAdminCommandException(e);
        }
    }
View Full Code Here

Examples of org.ejbca.core.model.ra.UserDataVO

            endEntityProfileSession.addEndEntityProfile(admin, "TESTCARDNUMBER", profile);
        } catch (EndEntityProfileExistsException pee) {}   
           
        profile = endEntityProfileSession.getEndEntityProfile(admin, "TESTCARDNUMBER");
           
        UserDataVO userdata = new UserDataVO("foo", "CN=foo", caid, "", "", SecConst.USER_ENDUSER, endEntityProfileSession.getEndEntityProfileId(admin, "TESTCARDNUMBER"), SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.TOKEN_SOFT_PEM, 0, null);
        userdata.setPassword("foo123");
        try {
      profile.doesUserFullfillEndEntityProfile(userdata, false);
    } catch (UserDoesntFullfillEndEntityProfile e) {
      log.debug(e.getMessage());
          ret = true;
    }
    assertTrue("User fullfilled the End Entity Profile even though the cardnumber was not sett", ret);
           
    ret = false;
        userdata.setCardNumber(cardnumber);
        try {
      profile.doesUserFullfillEndEntityProfile(userdata, false);
      ret = true;
    } catch (UserDoesntFullfillEndEntityProfile e) {
      log.debug(e.getMessage());
View Full Code Here

Examples of org.ejbca.core.model.ra.UserDataVO

              getLogger().error("Subject directory attributes must be supplied.");
              return;
            }
            getLogger().info("Setting subject directory attributes '" + attributes + "' for user " + username);
            try {
              UserDataVO uservo = ejb.getUserAdminSession().findUser(getAdmin(), username);
              ExtendedInformation ext = uservo.getExtendedinformation();
              if (ext == null) {
                ext = new ExtendedInformation();
              }
              ext.setSubjectDirectoryAttributes(attributes);
              uservo.setExtendedinformation(ext);
              ejb.getUserAdminSession().changeUser(getAdmin(), uservo, false);
            } catch (AuthorizationDeniedException e) {
              getLogger().error("Not authorized to change userdata.");
            } catch (UserDoesntFullfillEndEntityProfile e) {
              getLogger().error("Given userdata doesn't fullfill end entity profile. : " + e.getMessage());
View Full Code Here

Examples of org.ejbca.core.model.ra.UserDataVO

    public void setUp() throws Exception {
        super.setUp();
        adminUsername = genRandomUserName("revocationTestAdmin");
        requestingAdminUsername = genRandomUserName("revocationTestRequestingAdmin");
        UserDataVO userdata = new UserDataVO(adminUsername, "CN=" + adminUsername, caid, null, null, 1, SecConst.EMPTY_ENDENTITYPROFILE,
                SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.TOKEN_SOFT_P12, 0, null);
        userdata.setPassword("foo123");
        userAdminSession.addUser(internalAdmin, userdata, true);
        UserDataVO userdata2 = new UserDataVO(requestingAdminUsername, "CN=" + requestingAdminUsername, caid, null, null, 1, SecConst.EMPTY_ENDENTITYPROFILE,
                SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.TOKEN_SOFT_P12, 0, null);
        userdata2.setPassword("foo123");
        userAdminSession.addUser(internalAdmin, userdata2, true);
        BatchMakeP12 makep12 = new BatchMakeP12();
        File tmpfile = File.createTempFile("ejbca", "p12");
        makep12.setMainStoreDir(tmpfile.getParent());
        makep12.createAllNew();
View Full Code Here

Examples of org.ejbca.core.model.ra.UserDataVO

        usernameBase += (Integer.valueOf((new Random(new Date().getTime() + 4711)).nextInt(999999))).toString();
        return usernameBase;
    }

    private void createUser(Admin admin, String username, int caID) throws Exception {
        UserDataVO userdata = new UserDataVO(username, "CN=" + username, caID, null, null, 1, SecConst.EMPTY_ENDENTITYPROFILE,
                SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.TOKEN_SOFT_P12, 0, null);
        userdata.setPassword("foo123");
        userAdminSession.addUser(admin, userdata, true);
        BatchMakeP12 makep12 = new BatchMakeP12();
        File tmpfile = File.createTempFile("ejbca", "p12");
        makep12.setMainStoreDir(tmpfile.getParent());
        makep12.createAllNew();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.