Package org.ejbca.core.model.ra.raadmin

Examples of org.ejbca.core.model.ra.raadmin.EndEntityProfile


        log.trace("<test06RequestCounter()");
    }

    public void test07EndEntityProfileMappings() throws Exception {
      // Add a couple of profiles and verify that the mappings and get functions work
        EndEntityProfile profile1 = new EndEntityProfile();
        profile1.setPrinterName("foo");
        endEntityProfileSession.addEndEntityProfile(admin, "TESTEEPROFCACHE1", profile1);
        EndEntityProfile profile2 = new EndEntityProfile();
        profile2.setPrinterName("bar");
        endEntityProfileSession.addEndEntityProfile(admin, "TESTEEPROFCACHE2", profile2);
        int pid = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE1");
        String name = endEntityProfileSession.getEndEntityProfileName(admin, pid);
        int pid1 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE1");
        String name1 = endEntityProfileSession.getEndEntityProfileName(admin, pid1);
        assertEquals(pid, pid1);
        assertEquals(name, name1);
        EndEntityProfile profile = endEntityProfileSession.getEndEntityProfile(admin, pid);
        assertEquals("foo", profile.getPrinterName());
        profile = endEntityProfileSession.getEndEntityProfile(admin, name);
        assertEquals("foo", profile.getPrinterName());

        int pid2 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE2");
        String name2 = endEntityProfileSession.getEndEntityProfileName(admin, pid2);
        profile = endEntityProfileSession.getEndEntityProfile(admin, pid2);
        assertEquals("bar", profile.getPrinterName());
        profile = endEntityProfileSession.getEndEntityProfile(admin, name2);
        assertEquals("bar", profile.getPrinterName());

        // flush caches and make sure it is read correctly again
        endEntityProfileSession.flushProfileCache();

        int pid3 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE1");
        String name3 = endEntityProfileSession.getEndEntityProfileName(admin, pid3);
        assertEquals(pid1, pid3);
        assertEquals(name1, name3);
        profile = endEntityProfileSession.getEndEntityProfile(admin, pid3);
        assertEquals("foo", profile.getPrinterName());
        profile = endEntityProfileSession.getEndEntityProfile(admin, name3);
        assertEquals("foo", profile.getPrinterName());

        int pid4 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE2");
        String name4 = endEntityProfileSession.getEndEntityProfileName(admin, pid4);
        assertEquals(pid2, pid4);
        assertEquals(name2, name4);
        profile = endEntityProfileSession.getEndEntityProfile(admin, pid4);
        assertEquals("bar", profile.getPrinterName());
        profile = endEntityProfileSession.getEndEntityProfile(admin, name4);
        assertEquals("bar", profile.getPrinterName());

        // Remove a profile and make sure it is not cached still
        endEntityProfileSession.removeEndEntityProfile(admin, "TESTEEPROFCACHE1");
        profile = endEntityProfileSession.getEndEntityProfile(admin, pid1);
        assertNull(profile);
        int pid5 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE1");
        assertEquals(0, pid5);
        String name5 = endEntityProfileSession.getEndEntityProfileName(admin, pid5);
        assertNull(name5);

        // But the other, non-removed profile should still be there
        int pid6 = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEEPROFCACHE2");
        String name6 = endEntityProfileSession.getEndEntityProfileName(admin, pid6);
        assertEquals(pid2, pid6);
        assertEquals(name2, name6);
        profile = endEntityProfileSession.getEndEntityProfile(admin, pid6);
        assertEquals("bar", profile.getPrinterName());
        profile = endEntityProfileSession.getEndEntityProfile(admin, name6);
        assertEquals("bar", profile.getPrinterName());       
    } // test07EndEntityProfileMappings
View Full Code Here


        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTVALOVERRIDE");

        // Create a good end entity profile (good enough), allowing multiple UPN
        // names
        endEntityProfileSession.removeEndEntityProfile(admin, "TESTVALOVERRIDE");
        EndEntityProfile profile = new EndEntityProfile();
        profile.addField(DnComponents.COUNTRY);
        profile.addField(DnComponents.COMMONNAME);
        profile.setValue(EndEntityProfile.AVAILCAS, 0, Integer.toString(SecConst.ALLCAS));
        profile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, Integer.toString(cprofile));
        profile.setUse(EndEntityProfile.CARDNUMBER, 0, true);
        endEntityProfileSession.addEndEntityProfile(admin, "TESTVALOVERRIDE", profile);
        int eeprofile = endEntityProfileSession.getEndEntityProfileId(admin, "TESTVALOVERRIDE");
        // Change a user that we know...
        UserDataVO user = new UserDataVO("foo", "C=SE,CN=validityoverride", rsacaid, null, "foo@anatom.nu", SecConst.USER_ENDUSER, eeprofile, cprofile,
                SecConst.TOKEN_SOFT_PEM, 0, null);
View Full Code Here

        // Test that it works correctly with end entity profiles using the
        // counter
        int pid = 0;

        EndEntityProfile profile = new EndEntityProfile();
        profile.addField(DnComponents.ORGANIZATION);
        profile.addField(DnComponents.COUNTRY);
        profile.addField(DnComponents.COMMONNAME);
        profile.setValue(EndEntityProfile.AVAILCAS, 0, "" + rsacaid);
        profile.setUse(EndEntityProfile.ALLOWEDREQUESTS, 0, true);
        profile.setValue(EndEntityProfile.ALLOWEDREQUESTS, 0, "3");
        endEntityProfileSession.addEndEntityProfile(admin, "TESTREQUESTCOUNTER", profile);
        pid = endEntityProfileSession.getEndEntityProfileId(admin, "TESTREQUESTCOUNTER");

        // Change already existing user
        UserDataVO user = new UserDataVO("foo", "C=SE,O=AnaTom,CN=foo", rsacaid, null, null, SecConst.USER_ENDUSER, pid, SecConst.CERTPROFILE_FIXED_ENDUSER,
View Full Code Here

    public void test08EndEntityProfileCache() throws Exception {
      // First a check that we have the correct configuration, i.e. default
      long cachetime = EjbcaConfiguration.getCacheEndEntityProfileTime();
      assertEquals(1000, cachetime);
      // Make sure profile has the right value from the beginning
        EndEntityProfile eep = endEntityProfileSession.getEndEntityProfile(admin, "TESTEEPROFCACHE2");
        eep.setAllowMergeDnWebServices(false);
        endEntityProfileSession.changeEndEntityProfile(admin, "TESTEEPROFCACHE2", eep);
      // Read profile
        eep = endEntityProfileSession.getEndEntityProfile(admin, "TESTEEPROFCACHE2");
        boolean value = eep.getAllowMergeDnWebServices();
        assertFalse(value);

        // Flush caches to reset cache timeout
        endEntityProfileSession.flushProfileCache();
      // Change profile, not flushing cache
      eep.setAllowMergeDnWebServices(true);
      endEntityProfileSession.internalChangeEndEntityProfileNoFlushCache(admin, "TESTEEPROFCACHE2", eep);

      // Wait 2 seconds and try again, now the cache should have been updated
      Thread.sleep(2000);
        eep = endEntityProfileSession.getEndEntityProfile(admin, "TESTEEPROFCACHE2");
        value = eep.getAllowMergeDnWebServices();
        assertTrue(value);

        // Changing using the regular method however should immediately flush the cache
      eep.setAllowMergeDnWebServices(false);
      endEntityProfileSession.changeEndEntityProfile(admin, "TESTEEPROFCACHE2", eep);
        eep = endEntityProfileSession.getEndEntityProfile(admin, "TESTEEPROFCACHE2");
        value = eep.getAllowMergeDnWebServices();
        assertFalse(value);
    }
View Full Code Here

        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTDNORDER");

        // Create a good end entity profile (good enough), allowing multiple UPN
        // names
        endEntityProfileSession.removeEndEntityProfile(admin, "TESTDNORDER");
        EndEntityProfile profile = new EndEntityProfile();
        profile.addField(DnComponents.COUNTRY);
        profile.addField(DnComponents.ORGANIZATION);
        profile.addField(DnComponents.COMMONNAME);
        profile.setValue(EndEntityProfile.AVAILCAS, 0, Integer.toString(SecConst.ALLCAS));
        profile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, Integer.toString(cprofile));
        endEntityProfileSession.addEndEntityProfile(admin, "TESTDNORDER", profile);
        int eeprofile = endEntityProfileSession.getEndEntityProfileId(admin, "TESTDNORDER");

        UserDataVO user = new UserDataVO("foo", "C=SE,O=PrimeKey,CN=dnorder", rsacaid, null, "foo@primekey.se", SecConst.USER_ENDUSER, eeprofile, cprofile,
                SecConst.TOKEN_SOFT_PEM, 0, null);
View Full Code Here

        // Test that it works correctly with end entity profiles using the
        // counter
        int pid = 0;

        EndEntityProfile profile = new EndEntityProfile();
        profile.addField(DnComponents.ORGANIZATION);
        profile.addField(DnComponents.COUNTRY);
        profile.addField(DnComponents.COMMONNAME);
        profile.setValue(EndEntityProfile.AVAILCAS, 0, "" + rsacaid);
        profile.setUse(EndEntityProfile.ISSUANCEREVOCATIONREASON, 0, true);
        profile.setValue(EndEntityProfile.ISSUANCEREVOCATIONREASON, 0, "" + RevokedCertInfo.REVOCATION_REASON_CERTIFICATEHOLD);
        endEntityProfileSession.addEndEntityProfile(admin, "TESTISSUANCEREVREASON", profile);
        pid = endEntityProfileSession.getEndEntityProfileId(admin, "TESTISSUANCEREVREASON");

        // Change already existing user
        UserDataVO user = new UserDataVO("foo", "C=SE,O=AnaTom,CN=foo", rsacaid, null, null, SecConst.USER_ENDUSER, pid, SecConst.CERTPROFILE_FIXED_ENDUSER,
View Full Code Here

        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTDNOVERRIDE");

        // Create a good end entity profile (good enough), allowing multiple UPN
        // names
        endEntityProfileSession.removeEndEntityProfile(admin, "TESTDNOVERRIDE");
        EndEntityProfile profile = new EndEntityProfile();
        profile.addField(DnComponents.COUNTRY);
        profile.addField(DnComponents.COMMONNAME);
        profile.setValue(EndEntityProfile.AVAILCAS, 0, Integer.toString(SecConst.ALLCAS));
        profile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, Integer.toString(cprofile));
        endEntityProfileSession.addEndEntityProfile(admin, "TESTDNOVERRIDE", profile);
        int eeprofile = endEntityProfileSession.getEndEntityProfileId(admin, "TESTDNOVERRIDE");
        UserDataVO user = new UserDataVO("foo", "C=SE,CN=dnoverride", rsacaid, null, "foo@anatom.nu", SecConst.USER_ENDUSER, eeprofile, cprofile,
                SecConst.TOKEN_SOFT_PEM, 0, null);
        user.setPassword("foo123");
View Full Code Here

        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTEXTENSIONOVERRIDE");

        // Create a good end entity profile (good enough), allowing multiple UPN
        // names
        endEntityProfileSession.removeEndEntityProfile(admin, "TESTEXTENSIONOVERRIDE");
        EndEntityProfile profile = new EndEntityProfile();
        profile.addField(DnComponents.COUNTRY);
        profile.addField(DnComponents.COMMONNAME);
        profile.setValue(EndEntityProfile.AVAILCAS, 0, Integer.toString(SecConst.ALLCAS));
        profile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, Integer.toString(cprofile));
        endEntityProfileSession.addEndEntityProfile(admin, "TESTEXTENSIONOVERRIDE", profile);
        int eeprofile = endEntityProfileSession.getEndEntityProfileId(admin, "TESTEXTENSIONOVERRIDE");
        UserDataVO user = new UserDataVO("foo", "C=SE,CN=extoverride", rsacaid, null, "foo@anatom.nu", SecConst.USER_ENDUSER, eeprofile, cprofile,
                SecConst.TOKEN_SOFT_PEM, 0, null);
        user.setPassword("foo123");
View Full Code Here

        certificateProfileSession.addCertificateProfile(admin, "TESTSIGALG", certprof);
        int cprofile = certificateProfileSession.getCertificateProfileId(admin, "TESTSIGALG");

        // Create a good end entity profile (good enough)
        endEntityProfileSession.removeEndEntityProfile(admin, "TESTSIGALG");
        EndEntityProfile profile = new EndEntityProfile();
        profile.addField(DnComponents.COUNTRY);
        profile.addField(DnComponents.COMMONNAME);
        profile.setValue(EndEntityProfile.AVAILCAS, 0, Integer.toString(SecConst.ALLCAS));
        profile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, Integer.toString(cprofile));
        endEntityProfileSession.addEndEntityProfile(admin, "TESTSIGALG", profile);
        int eeprofile = endEntityProfileSession.getEndEntityProfileId(admin, "TESTSIGALG");
        UserDataVO user = new UserDataVO("foo", "C=SE,CN=testsigalg", rsacaid, null, "foo@anatom.nu", SecConst.USER_ENDUSER, eeprofile, cprofile,
                SecConst.TOKEN_SOFT_PEM, 0, null);
        user.setPassword("foo123");
View Full Code Here

      certProfile.setUsePrivateKeyUsagePeriodNotAfter(usePeriod);
      certProfile.setPrivateKeyUsagePeriodLength(period);
      certificateProfileSession.addCertificateProfile(admin, CERTPROFILE_PRIVKEYUSAGEPERIOD, certProfile);
      final int certProfileId = certificateProfileSession.getCertificateProfileId(admin, CERTPROFILE_PRIVKEYUSAGEPERIOD);
      endEntityProfileSession.removeEndEntityProfile(admin, EEPROFILE_PRIVKEYUSAGEPERIOD);
        final EndEntityProfile eeProfile = new EndEntityProfile();
        eeProfile.addField(DnComponents.COUNTRY);
        eeProfile.addField(DnComponents.COMMONNAME);
        eeProfile.setValue(EndEntityProfile.AVAILCAS, 0, Integer.toString(SecConst.ALLCAS));
        eeProfile.setValue(EndEntityProfile.AVAILCERTPROFILES, 0, Integer.toString(certProfileId));
        endEntityProfileSession.addEndEntityProfile(admin, EEPROFILE_PRIVKEYUSAGEPERIOD, eeProfile);
        final int eeProfileId = endEntityProfileSession.getEndEntityProfileId(admin, EEPROFILE_PRIVKEYUSAGEPERIOD);
        final UserDataVO user = new UserDataVO(USER_PRIVKEYUSAGEPERIOD, DN_PRIVKEYUSAGEPERIOD, rsacaid, null, "fooprivatekeyusae@example.com", SecConst.USER_ENDUSER, eeProfileId, certProfileId,
                SecConst.TOKEN_SOFT_PEM, 0, null);
        user.setPassword("foo123");
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.ra.raadmin.EndEntityProfile

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.