Package org.ejbca.config

Examples of org.ejbca.config.GlobalConfiguration


     * @throws Exception
     *             error
     */

    public void test05removeHardTokens() throws AuthorizationDeniedException {
        GlobalConfiguration gc = globalConfigurationSession.getCachedGlobalConfiguration(admin);
        gc.setHardTokenEncryptCA(orgEncryptCAId);
        globalConfigurationSession.saveGlobalConfigurationRemote(admin, gc);
   
        try {
            hardTokenSessionRemote.removeHardToken(admin, "1234");
            hardTokenSessionRemote.removeHardToken(admin, "2345");
View Full Code Here


  private boolean acceptedHost(String remotehost) {
    if (log.isTraceEnabled()) {
      log.trace(">acceptedHost: "+remotehost);
    }     
    boolean ret = false;
    GlobalConfiguration gc = globalconfigurationsession.getCachedGlobalConfiguration(Admin.getInternalAdmin());
    Set<String> nodes = gc.getNodesInCluster();
    Iterator<String> itr = nodes.iterator();
    String nodename = null;
    while (itr.hasNext()) {
      nodename = itr.next();
      try {
View Full Code Here

          Admin admin = new Admin(Admin.TYPE_CACOMMANDLINE_USER, "StartServicesServlet");
          endEntityProfileSession.initializeAndUpgradeProfiles(admin);
         
          // Add this node's hostname to list of nodes
            log.trace(">init checking if this node is in the list of nodes");
            final GlobalConfiguration config = globalConfigurationSession.getCachedGlobalConfiguration(admin);
            final Set<String> nodes = config.getNodesInCluster();
            final String hostname = getHostName();
            if (hostname != null && !nodes.contains(hostname)) {
              log.debug("Adding this node the list of nodes");
              nodes.add(hostname);
              config.setNodesInCluster(nodes);
              globalConfigurationSession.saveGlobalConfiguration(admin, config);
            }
        } catch (Exception e) {
          log.error("Error creating CAAdminSession: ", e);
        }
View Full Code Here

        this.authorizationsession = authorizationsession;
        this.administrator = administrator;
    }
   
    public GlobalConfiguration loadGlobalConfiguration() throws NamingException{
        GlobalConfiguration ret = null;
        // TODO: These should be dropped or moved to property files!!
        ret = globalconfigurationsession.getCachedGlobalConfiguration(administrator);
        if (initialContext == null) {
            initialContext = new InitialContext();
        }
        Context myenv = (Context) initialContext.lookup("java:comp/env");     
        ret.initialize( (String) myenv.lookup("ADMINDIRECTORY"),
            WebConfiguration.getAvailableLanguages(), (String) myenv.lookup("AVAILABLETHEMES"),
                ""+WebConfiguration.getPublicHttpPort(), ""+WebConfiguration.getPrivateHttpsPort(),
                (String) myenv.lookup("PUBLICPROTOCOL"),(String) myenv.lookup("PRIVATEPROTOCOL"));
        return ret;
    }
View Full Code Here

    public void test00SetEnableEndEntityProfileLimitations() throws Exception {
        // Global configuration must have "Enable End Entity Profile Limitations" set to true in order for
      // the request counter tests to pass, we check if we are allowed to set this value or not
      // The value is reset to whatever it was from the beginning in the last "clean up" test.
        GlobalConfiguration gc = globalConfigurationSession.getCachedGlobalConfiguration(admin);
        gcEELimitations = gc.getEnableEndEntityProfileLimitations();
        gc.setEnableEndEntityProfileLimitations(true);
        globalConfigurationSession.saveGlobalConfigurationRemote(admin, gc);
    }
View Full Code Here

     */
    public void test99CleanUp() throws Exception {
        log.trace(">test99CleanUp()");

        // Reset the value of "EnableEndEntityProfileLimitations" to whatever it was before we ran test00SetEnableEndEntityProfileLimitations
        GlobalConfiguration gc = globalConfigurationSession.getCachedGlobalConfiguration(admin);
        gc.setEnableEndEntityProfileLimitations(gcEELimitations);
        globalConfigurationSession.saveGlobalConfigurationRemote(admin, gc);

        // Delete test users we created
        try {         
            userAdminSession.deleteUser(admin,username);
View Full Code Here

        // Read a value to reset the timer
      globalConfigurationSession.getCachedGlobalConfiguration(administrator);
        setInitialValue();
       
        // Set a brand new value
        GlobalConfiguration newValue = new GlobalConfiguration();
        newValue.setEjbcaTitle("BAR");
        globalConfigurationSession.saveGlobalConfigurationRemote(administrator, newValue);

        GlobalConfiguration cachedValue = globalConfigurationSession.getCachedGlobalConfiguration(administrator);

        cachedValue = globalConfigurationSession.getCachedGlobalConfiguration(administrator);
        assertEquals("The GlobalConfigfuration cache was not automatically updated.", "BAR", cachedValue.getEjbcaTitle());

    }
View Full Code Here

     * Set a preliminary value and allows the cache to set it.
     * @throws InterruptedException
     */
    private void setInitialValue() throws InterruptedException, AuthorizationDeniedException {
       
        GlobalConfiguration initial = new GlobalConfiguration();
        initial.setEjbcaTitle("FOO");
        globalConfigurationSession.saveGlobalConfigurationRemote(administrator, initial);
    }
View Full Code Here

     * Enables/disables CLI and flushes caches unless the property does not
     * aready have the right value.
     * @param enable
     */
    private void enableCLI(final boolean enable) {
      final GlobalConfiguration config = globalConfigurationSession.flushCache();
      final GlobalConfiguration newConfig;
      if (config.getEnableCommandLineInterface() == enable) {
        newConfig = config;
      } else {
        config.setEnableCommandLineInterface(enable);
        globalConfigurationSession.saveGlobalConfigurationRemote(administrator, config);
        newConfig = globalConfigurationSession.flushCache();
      }
      assertEquals("CLI should have been enabled/disabled",
          enable, newConfig.getEnableCommandLineInterface());
      authorizationSession.flushAuthorizationRuleCache();
    }
View Full Code Here

        caInfo.setDoEnforceUniquePublicKeys(true);
        // make sure same DN for different users is prevented
        caInfo.setDoEnforceUniqueDistinguishedName(true);
        caAdminSession.editCA(administrator, caInfo);

        final GlobalConfiguration newGlobalConfig = globalConfigurationSession.getCachedGlobalConfiguration(administrator);
        newGlobalConfig.setEnableKeyRecovery(true);
        globalConfigurationSession.saveGlobalConfigurationRemote(administrator, newGlobalConfig);

        // Setup with two new Certificate profiles.
        final EndUserCertificateProfile profile1 = new EndUserCertificateProfile();
        profile1.setKeyUsage(CertificateProfile.DIGITALSIGNATURE, false);
View Full Code Here

TOP

Related Classes of org.ejbca.config.GlobalConfiguration

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.