Package com.adito.boot

Examples of com.adito.boot.ContextKey


    private void configureProxyServers() throws Exception {
        getBootProgressMonitor().updateMessage("Configuring proxy servers");
        getBootProgressMonitor().updateProgress(5);

        String httpProxyHost = contextConfiguration.retrieveProperty(new ContextKey("proxies.http.proxyHost"));
        if (!httpProxyHost.equals("")) {
            if (log.isInfoEnabled())
                log.info("Configuring outgoing HTTP connections to use a proxy server.");
            System.setProperty("http.proxyHost", httpProxyHost);
            System.setProperty("com.maverick.ssl.https.HTTPProxyHostname", httpProxyHost);
            String httpProxyPort = contextConfiguration.retrieveProperty(new ContextKey("proxies.http.proxyPort"));

            String httpProxyUsername = contextConfiguration.retrieveProperty(new ContextKey("proxies.http.proxyUser"));
            String httpProxyPassword = contextConfiguration.retrieveProperty(new ContextKey("proxies.http.proxyPassword"));

            System.setProperty("http.proxyPort", httpProxyPort);
            System.setProperty("com.maverick.ssl.https.HTTPProxyPort", httpProxyPort);

            if (!httpProxyUsername.trim().equals(""))
                System.setProperty("com.maverick.ssl.https.HTTPProxyUsername", httpProxyUsername.trim());

            if (!httpProxyPassword.trim().equals(""))
                System.setProperty("com.maverick.ssl.https.HTTPProxyPassword", httpProxyPassword.trim());

            System.setProperty("com.maverick.ssl.https.HTTPProxySecure", "false");

            PropertyList list = contextConfiguration.retrievePropertyList(new ContextKey("proxies.http.nonProxyHosts"));
            StringBuffer hosts = new StringBuffer();
            for (Iterator i = list.iterator(); i.hasNext();) {
                if (hosts.length() != 0) {
                    hosts.append("|");
                }
                hosts.append(i.next());
            }
            System.setProperty("http.nonProxyHosts", hosts.toString());
            System.setProperty("com.maverick.ssl.https.HTTPProxyNonProxyHosts", hosts.toString());
        }
        String socksProxyHost = contextConfiguration.retrieveProperty(new ContextKey("proxies.socksProxyHost"));
        if (!socksProxyHost.equals("")) {
            if (log.isInfoEnabled())
                log.info("Configuring outgoing TCP/IP connections to use a SOCKS proxy server.");
            System.setProperty("socksProxyHost", httpProxyHost);
            System.setProperty("socksProxyPort", contextConfiguration.retrieveProperty(new ContextKey("proxies.socksProxyPort")));
        }
        if (!socksProxyHost.equals("") || !httpProxyHost.equals("")) {
            Authenticator.setDefault(new ProxyAuthenticator());
        }
    }
View Full Code Here


        }
    }

    private Server createServer() throws MalformedURLException {
        Server server = new Server();
        if (contextConfiguration.retrievePropertyBoolean(new ContextKey("webServer.stats"))) {
            new StatsLogger(server, contextConfiguration.retrievePropertyInt(new ContextKey("webServer.statsUpdate")));
        }
        return server;
    }
View Full Code Here

        if (l == null) {
            l = new FileDownloadPageInterceptListener();
            CoreUtil.addPageInterceptListener(request.getSession(), l);
        }
        File f = new File(CoreUtil.getTempDownloadDirectory(getSessionInfo(request)), "server.csr");
        String pw = Property.getProperty(new ContextKey("webServer.keystore.sslCertificate.password"));
        String data = KeyStoreManager.getInstance(KeyStoreManager.DEFAULT_KEY_STORE).generateCSR(Property.getProperty(new ContextKey("webServer.alias")), pw);
        FileWriter fos = new FileWriter(f);
        fos.write(data);
        fos.flush();
        fos.close();
        l.addDownload(new CSRDownload(f, f.getName(), "application/octet-stream", mapping.findForward("success"),
View Full Code Here

    /* (non-Javadoc)
     * @see javax.net.ssl.X509KeyManager#chooseServerAlias(java.lang.String, java.security.Principal[], java.net.Socket)
     */
    public String chooseServerAlias(String keyType, Principal[] issuers, Socket socket) {
        String alias = ContextHolder.getContext().getConfig().retrieveProperty(new ContextKey("webServer.alias"));
        return alias;
    }
View Full Code Here

    /* (non-Javadoc)
     * @see javax.net.ssl.X509KeyManager#getPrivateKey(java.lang.String)
     */
    public PrivateKey getPrivateKey(String alias) {
        try {
            return (PrivateKey) KeyStoreManager.getInstance(KeyStoreManager.DEFAULT_KEY_STORE).getPrivateKey(contextConfig.retrieveProperty(new ContextKey("webServer.alias")), contextConfig.retrieveProperty(new ContextKey("webServer.keystore.sslCertificate.password")).toCharArray());
        } catch (Exception e) {
            Main.log.error(e);
        }
        return null;
    }
View Full Code Here

    /* (non-Javadoc)
     * @see javax.net.ssl.X509KeyManager#getServerAliases(java.lang.String, java.security.Principal[])
     */
    public String[] getServerAliases(String keyType, Principal[] issuers) {
        String str[] = { contextConfig.retrieveProperty(new ContextKey("webServer.alias")) };
        return str;
    }
View Full Code Here

  @Override
  public String processReplacementVariable(Pattern pattern, Matcher matcher, String replacementPattern, String type, String key) throws Exception {
    if (type.equalsIgnoreCase(KeyStoreManager.DEFAULT_KEY_STORE)) {
            if (key.equals("untrustedCertificate")) {
                return String.valueOf(!KeyStoreManager.getInstance(KeyStoreManager.DEFAULT_KEY_STORE)
                                .isCertificateTrusted(Property.getProperty(new ContextKey("webServer.alias"))));
            } else {
                throw new Exception("Unknown key " + key + " for type " + type + ".");
            }
        } else if (type.equalsIgnoreCase("server")) {
            // NOTE 29/1/06 - BPS - This is here to maintain
            // compatibility with current extension descriptors
            if (key.equals("untrustedCertificate")) {
                return String.valueOf(!KeyStoreManager.getInstance(KeyStoreManager.DEFAULT_KEY_STORE)
                                .isCertificateTrusted(Property.getProperty(new ContextKey("webServer.alias"))));
            } else if (key.equals("disableNewSSLEngine")){
                return SystemProperties.get("adito.disableNewSSLEngine", "false");
            } else {
                throw new Exception("Unknown key " + key + " for type " + type + ".");
            }
View Full Code Here

      createAvailableCipherSuitesList = false;
        }
       
        if(configureContext) {
         
          PropertyList list = ContextHolder.getContext().getConfig().retrievePropertyList(new ContextKey("ssl.supportedProtocols"));
         
          if(!list.isEmpty()) {
            serverSocket.setEnabledProtocols(list.asArray());
          }
           
          list = ContextHolder.getContext().getConfig().retrievePropertyList(new ContextKey("ssl.supportedCiphers"));
         
          if(!list.isEmpty()) {
            serverSocket.setEnabledCipherSuites(list.asArray());
          }
        }
View Full Code Here

    protected SSLServerSocketFactory createFactory() throws Exception {
        if(KeyStoreManager.getInstance(KeyStoreManager.DEFAULT_KEY_STORE).isKeyStoreEmpty()) {
            throw new Exception("The keystore does not contain any certificates. Please run the installation wizard (--install).");
        }
        KeyStore ks = KeyStoreManager.getInstance(KeyStoreManager.DEFAULT_KEY_STORE).getKeyStore();
        String pw = ContextHolder.getContext().getConfig().retrieveProperty(new ContextKey("webServer.keystore.sslCertificate.password"));
        KeyManager[] kma = new KeyManager[] { new CustomKeyManager(pw) };
        TrustManager[] tma = null;
        if(trustManager == null) {
            TrustManagerFactory tm = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
            tm.init(ks);
View Full Code Here

        KeyStoreManager mgr = KeyStoreManager.getInstance(KeyStoreManager.TRUSTED_SERVER_CERTIFICATES_KEY_STORE);
        mgr.importCert(alias, file, null);
        mgr.reloadKeystore();
        Certificate certif = mgr.getCertificate(alias);

        CoreEvent coreEvent = new CoreEvent(this, CoreEventConstants.KEYSTORE_TRUSTED_CERTIFICATE_IMPORTED, Property.getProperty(new ContextKey("webServer.alias")), seq.getSession())
                        .addAttribute(CoreAttributeConstants.EVENT_ATTR_CERTIFICATE_ALIAS, alias)
                        .addAttribute(CoreAttributeConstants.EVENT_ATTR_CERTIFICATE_TYPE, certif.getType())
                        .addAttribute(CoreAttributeConstants.EVENT_ATTR_CERTIFICATE_HOSTNAME, KeyStoreManager.getX509CertificateEntity((X509Certificate)certif, "cn"))
                        .addAttribute(CoreAttributeConstants.EVENT_ATTR_CERTIFICATE_ORGANISATIONAL_UNIT, KeyStoreManager.getX509CertificateEntity((X509Certificate)certif, "ou"))
                        .addAttribute(CoreAttributeConstants.EVENT_ATTR_CERTIFICATE_COMPANY, KeyStoreManager.getX509CertificateEntity((X509Certificate)certif, "o"))
View Full Code Here

TOP

Related Classes of com.adito.boot.ContextKey

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.