Package org.ejbca.core.model.log

Examples of org.ejbca.core.model.log.Admin


    Certificate testcert = CertTools.getCertfromByteArray(testcertenc);
    ArrayList<Approval> approvals = new ArrayList<Approval>();
   
    Approval ap = new Approval("test");
    Date apDate = ap.getApprovalDate();
    ap.setApprovalAdmin(true, new Admin(testcert, "USERNAME", null));
    approvals.add(ap);
   
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
     
View Full Code Here


   * @param allowNonAdmins true if we should verify that it is a real administrator, false only extracts the certificate and checks that it is not revoked.
   * @param wsContext web service context that contains the SSL information
   * @return Admin object based on the SSL client certificate
   */
  protected Admin getAdmin(boolean allowNonAdmins) throws AuthorizationDeniedException, EjbcaException {
    Admin admin = null;
    try {
      MessageContext msgContext = wsContext.getMessageContext();
      HttpServletRequest request = (HttpServletRequest) msgContext.get(MessageContext.SERVLET_REQUEST);
      X509Certificate[] certificates = (X509Certificate[]) request.getAttribute("javax.servlet.request.X509Certificate");

View Full Code Here

      throw new EjbcaException(ErrorCode.AUTH_CERT_NOT_RECEIVED,
                "Error no client certificate recieved used for authentication.");
    }

    try{
      Admin admin = userAdminSession.getAdmin(certificates[0]);
      userAdminSession.checkIfCertificateBelongToUser(admin, CertTools.getSerialNumber(certificates[0]), CertTools.getIssuerDN(certificates[0]));
      if(!authorizationSession.isAuthorizedNoLog(admin, AccessRulesConstants.ROLE_ADMINISTRATOR)) {
          Authorizer.throwAuthorizationException(admin, AccessRulesConstants.ROLE_ADMINISTRATOR, null);
      }
      retval = true;
View Full Code Here

            + "ifn1eHMbL8dGLd5bc2GNBZkmhFIEoDvbfn9jo7phlS8iyvF2YhC4eso8Xb+T7+BZ"
            + "QUOBOvc=").getBytes());
 
  public void testWriteExternal() throws Exception {
    Certificate testcert = CertTools.getCertfromByteArray(testcertenc);
    DummyApprovalRequest ar = new DummyApprovalRequest(new Admin(testcert, null, null),null,1,2, false);
   
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(ar);
      oos.flush();
View Full Code Here

   
  }

  public void testGenerateApprovalId() throws Exception {
    Certificate testcert = CertTools.getCertfromByteArray(testcertenc);
    DummyApprovalRequest ar = new DummyApprovalRequest(new Admin(testcert, null, null),null,1,2, false);
   
      int id1 = ar.generateApprovalId();
      int id2 = ar.generateApprovalId();
      assertEquals(id1, id2);
  }
View Full Code Here

    }
   
    @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
    @Override
  public void testRollback(final long rollbackTestTime) {
      final Admin internalAdmin = Admin.getInternalAdmin();
    log(internalAdmin, internalAdmin.getCaId(), LogConstants.MODULE_CUSTOM, new Date(rollbackTestTime), null, null,
        LogConstants.EVENT_INFO_UNKNOWN, "Test of rollback resistance of log-system.", null);
    throw new EJBException("Test of rollback resistance of log-system.");
  }
View Full Code Here

  public void editUser(final UserDataVOWS userdata)
      throws CADoesntExistsException, AuthorizationDeniedException, UserDoesntFullfillEndEntityProfile, EjbcaException, ApprovalException, WaitingForApprovalException {
        final IPatternLogger logger = TransactionLogger.getPatternLogger();
        try {
          final EjbcaWSHelper ejbhelper = new EjbcaWSHelper(wsContext, authorizationSession, caAdminSession, certificateProfileSession, certificateStoreSession, endEntityProfileSession, hardTokenSession, userAdminSession);
          final Admin admin = ejbhelper.getAdmin();
          logAdminName(admin,logger);
          final UserDataVO userdatavo = ejbhelper.convertUserDataVOWS(admin, userdata);
            if (userAdminSession.existsUser(admin, userdatavo.getUsername())) {
              if (log.isDebugEnabled()) {
                log.debug("User " + userdata.getUsername() + " exists, update the userdata. New status of user '"+userdata.getStatus()+"'." );         
View Full Code Here

            log.debug("Find user with match '"+usermatch.getMatchvalue()+"'.");
      }
        final IPatternLogger logger = TransactionLogger.getPatternLogger();
        try {
          final EjbcaWSHelper ejbhelper = new EjbcaWSHelper(wsContext, authorizationSession, caAdminSession, certificateProfileSession, certificateStoreSession, endEntityProfileSession, hardTokenSession, userAdminSession);
          final Admin admin = ejbhelper.getAdmin();
          logAdminName(admin,logger);
          final Query query = ejbhelper.convertUserMatch(admin, usermatch);           
          final Collection<UserDataVO> result = userAdminSession.query(admin, query, null,null, MAXNUMBEROFROWS); // also checks authorization
          if (result.size() > 0) {
            retval = new ArrayList<UserDataVOWS>(result.size());
View Full Code Here

    }
        final IPatternLogger logger = TransactionLogger.getPatternLogger();
    List<Certificate> retval = new ArrayList<Certificate>(0);
    try{
      final EjbcaWSHelper ejbhelper = new EjbcaWSHelper(wsContext, authorizationSession, caAdminSession, certificateProfileSession, certificateStoreSession, endEntityProfileSession, hardTokenSession, userAdminSession);
      final Admin admin = ejbhelper.getAdmin();
            logAdminName(admin,logger);
      if (userAdminSession.findUser(admin,username) != null) {  // checks authorization on CA and profiles and view_end_entity
        Collection<java.security.cert.Certificate> certs;
        if (onlyValid) {
          certs = certificateStoreSession.findCertificatesByUsernameAndStatus(admin, username, SecConst.CERT_ACTIVE);
View Full Code Here

    if (log.isTraceEnabled()) {
      log.trace(">getLastCertChain: "+username);
    }
    final List<Certificate> retval = new ArrayList<Certificate>();
    EjbcaWSHelper ejbhelper = new EjbcaWSHelper(wsContext, authorizationSession, caAdminSession, certificateProfileSession, certificateStoreSession, endEntityProfileSession, hardTokenSession, userAdminSession);
    Admin admin = ejbhelper.getAdmin();
        final IPatternLogger logger = TransactionLogger.getPatternLogger();
        logAdminName(admin,logger);
    try {
      if (userAdminSession.findUser(admin, username) != null) { // checks authorization on CA and profiles and view_end_entity
        Collection<java.security.cert.Certificate> certs = certificateStoreSession.findCertificatesByUsername(admin,username);
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.log.Admin

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.