Package org.ejbca.core.model.log

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


        final String testCaName = "FailureTestCA";
        final String testAdminName = "FailureAdmin";

        createTestCA(testCaName);

        Admin admin = new Admin(Admin.TYPE_CACOMMANDLINE_USER);
        Admin anAdmin = new Admin(getTestCACert(testCaName), testAdminName, null);

        List<AccessRule> accessrules = new ArrayList<AccessRule>();
        accessrules.add(new AccessRule(AccessRulesConstants.CAPREFIX + ("CN=" + testCaName).hashCode(), AccessRule.RULE_ACCEPT, false));

        cleanUpAdminGroupTests(anAdmin, TEST_GROUPNAME, accessrules);
View Full Code Here


    public void testIsAuthorizedToGroupWhenEmpty() throws AdminGroupExistsException {
        // Set up
        final String testCaName = "FailureTestCA";
        final String testAdminName = "FailureAdmin";
        createTestCA(testCaName);
        Admin anAdmin = new Admin(getTestCACert(testCaName), testAdminName, null);
        // Do test with external user and an empty group

        List<AccessRule> accessrules = new ArrayList<AccessRule>();
        accessrules.add(new AccessRule(AccessRulesConstants.CAPREFIX + ("CN=SpiderMonkey").hashCode(), AccessRule.RULE_ACCEPT, false));
       
        cleanUpAdminGroupTests(anAdmin, TEST_GROUPNAME, accessrules);
        adminGroupSession.addAdminGroup(anAdmin, TEST_GROUPNAME);
       
        try {
            assertTrue("Admin of type " + anAdmin + " with username " + anAdmin.getUsername() + " was authorized to group <" + TEST_GROUPNAME
                    + "> incorrectly when group was empty.", authorizationSession.isAuthorizedToGroup(anAdmin, TEST_GROUPNAME));
        } finally {
            // Clean up
            adminGroupSession.removeAdminGroup(anAdmin, TEST_GROUPNAME);
            removeTestCA(testCaName);
View Full Code Here

        // Set up
        final String testCaName = "FailureTestCA";
        final String testAdminName = "FailureAdmin";
        createTestCA(testCaName);

        Admin anAdmin = new Admin(getTestCACert(testCaName), testAdminName, null);

        List<AccessRule> accessrules = new ArrayList<AccessRule>();
        accessrules.add(new AccessRule(AccessRulesConstants.CAPREFIX + ("CN=SpiderMonkey").hashCode(), AccessRule.RULE_ACCEPT, false));

        cleanUpAdminGroupTests(anAdmin, TEST_GROUPNAME, accessrules);
        adminGroupSession.addAdminGroup(anAdmin, TEST_GROUPNAME);

        try {
            List<AdminEntity> adminEntities = new ArrayList<AdminEntity>();
            adminEntities.add(new AdminEntity(AdminEntity.WITH_COMMONNAME, AdminEntity.TYPE_EQUALCASEINS, DEFAULT_SUPERADMIN_CN,
                    "CN=TEST Authorization,O=PrimeKey,C=SE".hashCode()));
           
            adminEntitySession.addAdminEntities(anAdmin, TEST_GROUPNAME, adminEntities);

            assertFalse("Admin of type " + anAdmin + " with username " + anAdmin.getUsername() + " was authorized to group <" + TEST_GROUPNAME
                    + "> incorrectly when group was not empty.", authorizationSession.isAuthorizedToGroup(anAdmin, TEST_GROUPNAME));

        } finally {
            // Clean up
            adminGroupSession.removeAdminGroup(anAdmin, TEST_GROUPNAME);
View Full Code Here

            removeTestCA(testCaName);
        }
    }
   
    public void testExistsEndEntityProfileInRules() {
        Admin admin = new Admin(Admin.TYPE_CACOMMANDLINE_USER);
        // profile id, random, should not exist in any rules
        Random rand = new Random();
        int id = rand.nextInt(100000);
      boolean result = authorizationSession.existsEndEntityProfileInRules(admin, id);
      assertFalse("Id "+id+" exists in access rules, did we generate a real existing id?", result);
View Full Code Here

      if(!errorpage_initialized){
             
        if(administrator == null){
          String remoteAddr = request.getRemoteAddr();
          administrator = new Admin(Admin.TYPE_PUBLIC_WEB_USER, remoteAddr);
        }
        commonInit();
       
        adminspreferences = new AdminPreferenceDataHandler(administrator);
View Full Code Here

    public boolean isAuthorizedNoLog(int resource) throws AuthorizationDeniedException {
      boolean returnval=false;
      if(certificates != null){
        if(raauthorized[resource] == null) {
          // We don't bother to lookup the admin's username and email for this check..
          raauthorized[resource] = Boolean.valueOf(authorizationSession.isAuthorizedNoLog(new Admin(certificates[0], null, null),AUTHORIZED_RA_RESOURCES[resource]));
        }
        returnval = raauthorized[resource].booleanValue();
      } else{
        throw new  AuthorizationDeniedException("Client certificate required.");
      }
View Full Code Here

    public void setUp() throws Exception {
        log.trace(">setUp()");
        CryptoProviderTools.installBCProvider();
        Certificate cert;
        Admin adm = new Admin(Admin.TYPE_CACOMMANDLINE_USER);
        m_certs = new HashSet<Certificate>();
        m_certfps = new HashSet<String>();
        cert = CertTools.getCertfromByteArray(testrootcert);
        m_certs.add(cert);
        m_certfps.add(CertTools.getFingerprintAsString(cert));
        // log.debug(cert.getIssuerDN().getName()+";"+cert.getSerialNumber().toString(16)+";"+CertTools.getFingerprintAsString(cert));
        rootCaFp = CertTools.getFingerprintAsString(cert);
        try {
            if (certificateStoreSession.findCertificateByFingerprint(adm, rootCaFp) == null) {
                certificateStoreSession.storeCertificate(adm, cert, "o=AnaTom,c=SE", rootCaFp, SecConst.CERT_ACTIVE, SecConst.CERTTYPE_ROOTCA,
                        SecConst.CERTPROFILE_FIXED_ROOTCA, null, new Date().getTime());
            }
            cert = CertTools.getCertfromByteArray(testcacert);
            m_certs.add(cert);
            m_certfps.add(CertTools.getFingerprintAsString(cert));
            // log.debug(cert.getIssuerDN().getName()+";"+cert.getSerialNumber().toString(16)+";"+CertTools.getFingerprintAsString(cert));
            subCaFp = CertTools.getFingerprintAsString(cert);
            if (certificateStoreSession.findCertificateByFingerprint(adm, subCaFp) == null) {
                certificateStoreSession.storeCertificate(adm, cert, "o=AnaTom,c=SE", subCaFp, SecConst.CERT_ACTIVE, SecConst.CERTTYPE_SUBCA,
                        SecConst.CERTPROFILE_FIXED_SUBCA, null, new Date().getTime());
            }
            cert = CertTools.getCertfromByteArray(testcert);
            m_certs.add(cert);
            m_certfps.add(CertTools.getFingerprintAsString(cert));
            // log.debug(cert.getIssuerDN().getName()+";"+cert.getSerialNumber().toString(16)+";"+CertTools.getFingerprintAsString(cert));
            endEntityFp = CertTools.getFingerprintAsString(cert);
            if (certificateStoreSession.findCertificateByFingerprint(adm, endEntityFp) == null) {
                certificateStoreSession.storeCertificate(adm, cert, "o=AnaTom,c=SE", endEntityFp, SecConst.CERT_ACTIVE, SecConst.CERTTYPE_ENDENTITY,
                        SecConst.CERTPROFILE_FIXED_ENDUSER, null, new Date().getTime());
            }
        } catch (Exception e) {
            log.error("Error: ", e);
            assertTrue("Error seting up tests: " + e.getMessage(), false);
        }
        admin = new Admin(Admin.TYPE_CACOMMANDLINE_USER);
        log.trace("<setUp()");
    }
View Full Code Here

        ((SoftCATokenInfo) catokeninfo).setSignKeyAlgorithm(AlgorithmConstants.KEYALGORITHM_ECDSA);
        ((SoftCATokenInfo) catokeninfo).setSignKeySpec("prime192v1");
        catokeninfo.setEncryptionAlgorithm(AlgorithmConstants.SIGALG_SHA1_WITH_RSA);
        ((SoftCATokenInfo) catokeninfo).setEncKeyAlgorithm(AlgorithmConstants.KEYALGORITHM_RSA);
        ((SoftCATokenInfo) catokeninfo).setEncKeySpec("2048");
    subTestPublicAccess(catokeninfo, new Admin(Admin.TYPE_PUBLIC_WEB_USER));
      log.trace("<test05ImportExport()");
  } // test05ImportExport
View Full Code Here

    byte[] keystorebytes = null;
        String caname = "DummyTestCA";
        String capassword = "foo123";
        String keyFingerPrint = null;
        cainfo = getNewCAInfo(caname, catokeninfo);
      Admin admin = new Admin(Admin.TYPE_CACOMMANDLINE_USER);
      boolean defaultRetValue = false;
        if ( admin.getAdminType() == Admin.TYPE_CACOMMANDLINE_USER ) {
          defaultRetValue = true;
        }
    try {
        caSession.removeCA(admin, cainfo.getCAId());
    } catch (Exception e) { }
View Full Code Here

    byte[] keystorebytes = null;
        String caname = "DummyTestCA";
        String capassword = "foo123";
        String keyFingerPrint = null;
        cainfo = getNewCAInfo(caname, catokeninfo);
        Admin internalAdmin = new Admin(Admin.TYPE_CACOMMANDLINE_USER);
    try {
        caSession.removeCA(internalAdmin, cainfo.getCAId());
    } catch (Exception e) { }
    boolean ret = false;
    try {
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.