Package org.ejbca.core.model.ra

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


    }
   
    private boolean hasServiceRun(final String username) throws Exception {
      // Now the user will be expired
      final boolean result;
        final UserDataVO data = getUserAdminSession().findUser(admin, username);
        final int status;
        if (data == null) {
          throw new Exception("User we have added can not be found");
        }
        status = data.getStatus();
        log.debug("status: " + status);
        result = status == UserDataConstants.STATUS_GENERATED;
        return result;
    }
View Full Code Here


              certGen.setPublicKey(key_pair.getPublic());
              certGen.setSignatureAlgorithm("SHA1withRSA");
              final X509Certificate certificate = certGen.generate(key_pair.getPrivate(), "BC");
              final String fingerprint = CertTools.getFingerprintAsString(certificate);
              // We add all certificates that does not have a user already to "missing_user_name"
              final UserDataVO missingUserDataVO = ejb.getUserAdminSession().findUser(getAdmin(), missing_user_name);
              if (missingUserDataVO == null) {
                // Add the user and change status to REVOKED
                getLogger().debug("Loading/updating user " + missing_user_name);
                final UserDataVO userdataNew = new UserDataVO(missing_user_name, CertTools.getSubjectDN(certificate), cainfo.getCAId(), null, null,
                    UserDataConstants.STATUS_NEW, SecConst.USER_ENDUSER, SecConst.EMPTY_ENDENTITYPROFILE,
                    SecConst.CERTPROFILE_FIXED_ENDUSER, null, null, SecConst.TOKEN_SOFT_BROWSERGEN, SecConst.NO_HARDTOKENISSUER, null);
                userdataNew.setPassword("foo123");
                ejb.getUserAdminSession().addUser(getAdmin(), userdataNew, false);
                getLogger().info("User '" + missing_user_name + "' has been added.");
                ejb.getUserAdminSession().setUserStatus(getAdmin(), missing_user_name, UserDataConstants.STATUS_REVOKED);
                getLogger().info("User '" + missing_user_name + "' has been updated.");
              }
View Full Code Here

            keyRecoverySession.addKeyRecoveryData(pubAdmin, cert, userDataVO.getUsername(), keyPair);
        }

        // Save the revocation code
        if(revocationCode != null && !recover){
          UserDataVO data = userAdminSession.findUser(pubAdmin, userDataVO.getUsername());
          ExtendedInformation ei = data.getExtendedinformation();
          if (ei == null) {
            ei = new ExtendedInformation();
          }
          ei.setRevocationCodeIdentifier(revocationCode);
          data.setExtendedinformation(ei);
          userAdminSession.changeUser(raAdmin, data, true);

        }

        if(privKey != null){
View Full Code Here

        }
    return GeneralizedKRSSMessageHelper.getAuthenticationType(req).getKeyBindingAuthentication() != null;
  }
 
  protected UserDataVO findUserData(String subjectDN) {
    UserDataVO retval = null;
   
    if(subjectDN != null){
      try {
        retval = userAdminSession.findUserBySubjectDN(pubAdmin, subjectDN);
      } catch (AuthorizationDeniedException e) {
View Full Code Here

  /**
   * Method finding the userdata of the specified cert or null
   * if the user couldn't be foundl
   */
  protected UserDataVO findUserData(X509Certificate cert) {
    UserDataVO retval = null;
    try {
      String username = certificateStoreSession.findUsernameByCertSerno(pubAdmin, cert.getSerialNumber(), CertTools.getIssuerDN(cert));
      if (log.isDebugEnabled()) {
        log.debug("Username for certificate with issuerDN:"+CertTools.getIssuerDN(cert)+", serialNo:"+CertTools.getSerialNumber(cert)+" :"+username);
      }
View Full Code Here

      if (CertTools.getNotAfter(certificate).compareTo(new java.util.Date()) < 0) {
        status = SecConst.CERT_ARCHIVED;
      }
     
      // Check if username already exists.
      UserDataVO userdata = ejb.getUserAdminSession().findUser(getAdmin(), username);
      if (userdata != null) {
        if (userdata.getStatus() != UserDataConstants.STATUS_REVOKED) {
          throw new Exception("User " + username +
          " already exists; only revoked user can be overwrite.");
        }
      }
     
View Full Code Here

        serviceSession.activateServiceTimer(admin, "TestUserPasswordService");

        // The service will run...

        // Now the user will not have been expired
        UserDataVO data = userAdminSession.findUser(admin, USERNAME);
        assertNotNull("User we have added can not be found", data);
        assertEquals(UserDataConstants.STATUS_NEW, data.getStatus());

        // Change the service to expire user after 5 seconds instead of after 5
        // hours
        workerprop.setProperty(BaseWorker.PROP_TIMEUNIT, BaseWorker.UNIT_SECONDS);
        // Include a dummy CA so we can see that the query works with checking
        // several CAs
        workerprop.setProperty(BaseWorker.PROP_CAIDSTOCHECK, String.valueOf(caid) + ";45");
        config.setWorkerProperties(workerprop);
        serviceSession.changeService(admin, "TestUserPasswordService", config, false);

        Thread.sleep(10000);

        // Now the user will be expired
        data = userAdminSession.findUser(admin, USERNAME);
        assertNotNull("User we have added can not be found", data);
        assertEquals(UserDataConstants.STATUS_GENERATED, data.getStatus());

        log.trace("<test01CreateNewUser()");
    }
View Full Code Here

   
    /**
     * Non-searchable information about a user.
     */
    public UserDataVO toUserDataVO() {
        final UserDataVO data = new UserDataVO();
        data.setUsername(getUsername());
        data.setCAId(getCaId());
        data.setCertificateProfileId(getCertificateProfileId());
        data.setDN(getSubjectDN());
        data.setEmail(getSubjectEmail());
        data.setEndEntityProfileId(getEndEntityProfileId());
        data.setExtendedinformation(getExtendedInformation());
        data.setHardTokenIssuerId(getHardTokenIssuerId());
        data.setPassword(getClearPassword());
        data.setStatus(getStatus());
        data.setSubjectAltName(getSubjectAltName());
        data.setTimeCreated(new Date(getTimeCreated()));
        data.setTimeModified(new Date(getTimeModified()));
        data.setTokenType(getTokenType());
        data.setType(getType());
        data.setCardNumber(getCardNumber());
        return data;
    }
View Full Code Here

        ExtendedInformation ext = null;
        if (dirAttributes != null) {
            ext = new ExtendedInformation();
            ext.setSubjectDirectoryAttributes(dirAttributes);
        }
           return  new UserDataVO(submessage.getUsername(),
                   submessage.getSubjectDN(),
                   getCAId(admin,submessage.getCAName()),
                   submessage.getSubjectAltName(),
                   submessage.getEmail(),
                   UserDataConstants.STATUS_INPROCESS,
View Full Code Here

          log.debug("Found at least one failed approval request for approvalid: "+approvalid);
          throw new Exception("Approval request execution failed for approvalid: "+approvalid);
        }
       
    // Check if user already exists
    UserDataVO oldUserData = userAdminSession.findUser(admin, userdata.getUsername());
    if (oldUserData != null) {
      log.debug("User '"+userdata.getUsername()+"' already exist, edit user.");
      if ( (oldUserData.getStatus() == UserDataConstants.STATUS_INPROCESS) || (oldUserData.getStatus() == UserDataConstants.STATUS_NEW) ) {
        log.info("User '"+userdata.getUsername()+"' have status NEW or INPROCESS, we will NOT edit it");
      } else {
        userdata.setStatus(status);
        userAdminSession.changeUser(admin,userdata,clearpwd);       
      }
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.