Package org.ejbca.core.model.ra

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


    public void test04FailAuthenticateUser() throws Exception {
        log.trace(">test04FailAuthenticateUser()");
        // user that we know exists... but we issue wrong password
        boolean authfailed = false;
        try {
            UserDataVO auth = authenticationSessionRemote.authenticateUser(admin, username1, "abc123");
            log.debug("Authenticated user: " + auth.getUsername());
        } catch (Exception e) {
            authfailed = true;
        }
        assertTrue("Authentication succeeded when it should have failed.", authfailed);
        log.trace("<test04FailAuthenticateUser()");
View Full Code Here


        userAdminSession.prepareForKeyRecovery(admin, username1, SecConst.EMPTY_ENDENTITYPROFILE, null);

        assertTrue("Failure the users keyrecovery session should have been marked", keyRecoverySession.isUserMarked(admin, username1));

        // Now finish the user (The actual test)
        UserDataVO userdata = userAdminSession.findUser(admin, username1);
        authenticationSessionRemote.finishUser(userdata);
        // And se if the user is still marked

        assertTrue("Failure the users keyrecovery session should have been unmarked", !keyRecoverySession.isUserMarked(admin, username1));
View Full Code Here

    usekeyrecovery  = globalConfigurationSession.getCachedGlobalConfiguration(internalUser).getEnableKeyRecovery();
      if (log.isDebugEnabled()) {
        log.debug("Key recovery enabled: "+ usekeyrecovery);
      }
    PKCS12Response retval = null;
        UserDataVO userdata = null;
    try{
            userdata = generateUserDataVO(admin, submessage);
            userdata.setPassword("foo123");
        storeUserData(admin, userdata, false, UserDataConstants.STATUS_INPROCESS);
       
        // Generate keys
        KeyPair keys = generateKeys(submessage);
        // Generate Certificate
View Full Code Here

      // Check user
      int tokentype = SecConst.TOKEN_SOFT_BROWSERGEN;

      usekeyrecovery = globalConfigurationSession.getCachedGlobalConfiguration(administrator).getEnableKeyRecovery();

      UserDataVO data = userAdminSession.findUser(administrator, username);

      if (data == null) {
        throw new ObjectNotFoundException();
      }

      boolean savekeys = data.getKeyRecoverable() && usekeyrecovery &&  (data.getStatus() != UserDataConstants.STATUS_KEYRECOVERY);
      boolean loadkeys = (data.getStatus() == UserDataConstants.STATUS_KEYRECOVERY) && usekeyrecovery;

      int endEntityProfileId = data.getEndEntityProfileId();
      int certificateProfileId = data.getCertificateProfileId();
      EndEntityProfile endEntityProfile = endEntityProfileSession.getEndEntityProfile(administrator, endEntityProfileId);
      boolean reusecertificate = endEntityProfile.getReUseKeyRecoveredCertificate();
      // Set a new certificate profile, if we have requested one specific
      if (StringUtils.isNotEmpty(certprofile)) {
        boolean clearpwd = StringUtils.isNotEmpty(data.getPassword());
        int id = certificateProfileSession.getCertificateProfileId(administrator, certprofile);
        // Change the value if there exists a certprofile with the requested name, and it is not the same as
        // the one already registered to be used by default
        if ( (id > 0) ) {
          if (id != certificateProfileId) {
            // Check if it is in allowed profiles in the entity profile
            Collection c = endEntityProfile.getAvailableCertificateProfileIds();
            if (c.contains(String.valueOf(id))) {
              data.setCertificateProfileId(id);
              // This admin can be the public web user, which may not be allowed to change status,
              // this is a bit ugly, but what can a man do...
              Admin tempadmin = Admin.getInternalAdmin();
              userAdminSession.changeUser(tempadmin, data, clearpwd);                                 
            } else {
              String defaultCertificateProfileName = certificateProfileSession.getCertificateProfileName(administrator, certificateProfileId);
              log.info(intres.getLocalizedMessage("certreq.badcertprofile", certprofile, defaultCertificateProfileName));
            }
          }
        } else {
          String defaultCertificateProfileName = certificateProfileSession.getCertificateProfileName(administrator, certificateProfileId);
          log.info(intres.getLocalizedMessage("certreq.nosuchcertprofile", certprofile, defaultCertificateProfileName));
        }
      }

      // get users Token Type.
      tokentype = data.getTokenType();
      GenerateToken tgen = new GenerateToken(authenticationSession, userAdminSession, caAdminSession, keyRecoverySession, signSession);
      if(tokentype == SecConst.TOKEN_SOFT_P12){
        KeyStore ks = tgen.generateOrKeyRecoverToken(administrator, username, password, data.getCAId(), keylength, keyalg, false, loadkeys, savekeys, reusecertificate, endEntityProfileId);
        if (StringUtils.equals(openvpn, "on")) {               
          sendOpenVPNToken(ks, username, password, response);
        } else {
          sendP12Token(ks, username, password, response);
        }
      }
      if(tokentype == SecConst.TOKEN_SOFT_JKS){
        KeyStore ks = tgen.generateOrKeyRecoverToken(administrator, username, password, data.getCAId(), keylength, keyalg, true, loadkeys, savekeys, reusecertificate, endEntityProfileId);
        sendJKSToken(ks, username, password, response);
      }
      if(tokentype == SecConst.TOKEN_SOFT_PEM){
        KeyStore ks = tgen.generateOrKeyRecoverToken(administrator, username, password, data.getCAId(), keylength, keyalg, false, loadkeys, savekeys, reusecertificate, endEntityProfileId);
        sendPEMTokens(ks, username, password, response);
      }
      if(tokentype == SecConst.TOKEN_SOFT_BROWSERGEN){

        // first check if it is a Firefox request,
View Full Code Here

        adminusername1 = genRandomUserName();

        CAInfo cainfo = caAdminSessionRemote.getCAInfo(intAdmin, getAdminCAName());
        caid = cainfo.getCAId();

        UserDataVO userdata = new UserDataVO(adminusername1, "CN=" + adminusername1, caid, null, null, 1, SecConst.EMPTY_ENDENTITYPROFILE,
                SecConst.CERTPROFILE_FIXED_ENDUSER, SecConst.TOKEN_SOFT_P12, 0, null);
        userdata.setPassword("foo123");
        userAdminSession.addUser(intadmin, userdata, true);

        BatchMakeP12 makep12 = new BatchMakeP12();
        File tmpfile = File.createTempFile("ejbca", "p12");
View Full Code Here

          if(log.isDebugEnabled()) {
            log.debug("Got renewal request for " + username + ".");
          }
          String statusMessage;
          try {
            UserDataVO userdata = useradminhome.findUser(admin, username);
            EndEntityProfile profile = endEntityProfileSession.getEndEntityProfile(admin, userdata.getEndEntityProfileId());
            userdata.setPassword(profile.getAutoGeneratedPasswd());
            userdata.setStatus(UserDataConstants.STATUS_NEW);
            useradminhome.changeUser(admin, userdata, false);
            statusMessage = "Your request for certificate renewal has been submitted.";
          } catch(WaitingForApprovalException ex) {
            statusMessage = "Your request for certificate renewal has been submitted and is now waiting for approval.";
          } catch(ApprovalException ex) {
View Full Code Here

      Iterator i; 
      this.users.clear();
      if(importusers!=null && importusers.size() > 0){
        i=importusers.iterator();
        while(i.hasNext()){
          UserDataVO nextuser = (UserDataVO) i.next()
          user = new UserView(nextuser, caidtonamemap);
          user.setSortBy(this.sortby);
          users.add(user);
        }
        Collections.sort(users);
View Full Code Here

*/
public class UserView implements java.io.Serializable, Cloneable, Comparable {
    // Public constants.

   public UserView(){
      userdata = new UserDataVO();
      userdata.setType(1);
      subjectdnfields = new DNFieldExtractor("", DNFieldExtractor.TYPE_SUBJECTDN);
      subjectaltnames = new DNFieldExtractor("", DNFieldExtractor.TYPE_SUBJECTALTNAME);
      subjectdirattrs = new DNFieldExtractor("", DNFieldExtractor.TYPE_SUBJECTDIRATTR);
   }
View Full Code Here

      final XKMSCAServiceInfo info = (XKMSCAServiceInfo) getExtendedCAServiceInfo();      
      // Create XKMS KeyStore     
      final KeyStore keystore = KeyStore.getInstance("PKCS12", "BC");
      keystore.load(null, null);                             
      final KeyPair xKMSkeys = KeyTools.genKeys(info.getKeySpec(), info.getKeyAlgorithm());
      final UserDataVO user = new UserDataVO("NOUSERNAME", info.getSubjectDN(), 0, info.getSubjectAltName(), "NOEMAIL", 0,0,0,0, null,null,0,0,null);
      final Certificate xKMSCertificate = ca.generateCertificate(user, xKMSkeys.getPublic(),
          -1, // KeyUsage
          ca.getValidity(), new XKMSCertificateProfile(),
          null // sequence
      );
View Full Code Here

   
    /** Adds a user to the database, the string array must be in format defined in class UserView. */
    public void addUser(UserView userdata) throws PersistenceException, CADoesntExistsException, AuthorizationDeniedException, UserDoesntFullfillEndEntityProfile, WaitingForApprovalException, EjbcaException {
        log.trace(">addUser()");
        if (userdata.getEndEntityProfileId() != 0) {
            UserDataVO uservo = new UserDataVO(userdata.getUsername(), userdata.getSubjectDN(), userdata.getCAId(), userdata.getSubjectAltName(),
            userdata.getEmail(), UserDataConstants.STATUS_NEW, userdata.getType(), userdata.getEndEntityProfileId(), userdata.getCertificateProfileId(),
            null,null, userdata.getTokenType(), userdata.getHardTokenIssuerId(), null);
            uservo.setPassword(userdata.getPassword());
            uservo.setExtendedinformation(userdata.getExtendedInformation());
            uservo.setCardNumber(userdata.getCardNumber());
            userAdminSession.addUser(administrator, uservo, userdata.getClearTextPassword());
            addedusermemory.addUser(userdata);
        } else {
            log.debug("=addUser(): profile id not set, user not created");
        }
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.ra.UserDataVO

Copyright © 2018 www.massapicom. 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.