Search in sources :

Example 1 with Security

use of org.glassfish.appclient.client.acc.config.Security in project Payara by payara.

the class TargetServerHelper method selectEndpointsFromConfig.

private static List<TargetServer> selectEndpointsFromConfig(ClientContainer cc) {
    /*
         * Scan the property elements in the configuration for useful information.
         */
    /*
         * If the configuration specifies the "ssl" property then add a
         * child security element to each TargetServer created for the
         * target-server elements.
         */
    boolean isGlobalSSL = false;
    for (Property p : cc.getProperty()) {
        /*            if (p.getName().equals(GlassFishORBManager.IIOP_ENDPOINTS_PROPERTY)) {
                endpointPropertySetting = p.getValue();
             } else {
 */
        if (p.getName().equals(SSL_PROPERTY_NAME)) {
            isGlobalSSL = Boolean.parseBoolean(p.getValue());
        }
    // }
    }
    List<TargetServer> endpoints = new ArrayList<TargetServer>();
    /*
         * Start the target list with those specified in the configuration.
         */
    endpoints.addAll(cc.getTargetServer());
    /*
         * For all target servers assembled so far, if one does not have a
         * user-specified security child but the global SSL property was set
         * then add a security child.
         */
    for (TargetServer ts : endpoints) {
        /*
             * If the user selected SSL by setting that property in the
             * config then add a security child, because the AppClientContainer
             * expects each TargetServer object to declare its own
             * security needs explicitly.
             *
             * Note that if the user already defined a security element for the
             * target server we don't override it.
             */
        if (isGlobalSSL && ts.getSecurity() == null) {
            Security sec = new Security();
            ts.setSecurity(sec);
        }
    }
    return endpoints;
}
Also used : ArrayList(java.util.ArrayList) TargetServer(org.glassfish.appclient.client.acc.config.TargetServer) Security(org.glassfish.appclient.client.acc.config.Security) Property(org.glassfish.appclient.client.acc.config.Property)

Example 2 with Security

use of org.glassfish.appclient.client.acc.config.Security in project Payara by payara.

the class AppClientSecurityInfoImpl method setSSLData.

private void setSSLData(List<TargetServer> tServers) {
    try {
        // Set the SSL related properties for ORB
        TargetServer tServer = tServers.get(0);
        // TargetServer is required.
        // temp solution to target-server+ change in DTD
        // assuming that multiple servers can be specified but only 1st
        // first one will be used.
        Security security = tServer.getSecurity();
        if (security == null) {
            _logger.fine("No Security input set in ClientContainer.xml");
            // do nothing
            return;
        }
        Ssl ssl = security.getSsl();
        if (ssl == null) {
            _logger.fine("No SSL input set in ClientContainer.xml");
            // do nothing
            return;
        }
        // XXX do not use NSS in this release
        // CertDb   certDB  = security.getCertDb();
        sslUtils.setAppclientSsl(convert(ssl));
        this.appClientSSLUtil.setAppClientSSL(convert(ssl));
    } catch (Exception ex) {
    }
}
Also used : TargetServer(org.glassfish.appclient.client.acc.config.TargetServer) Security(org.glassfish.appclient.client.acc.config.Security) Ssl(org.glassfish.appclient.client.acc.config.Ssl)

Aggregations

Security (org.glassfish.appclient.client.acc.config.Security)2 TargetServer (org.glassfish.appclient.client.acc.config.TargetServer)2 ArrayList (java.util.ArrayList)1 Property (org.glassfish.appclient.client.acc.config.Property)1 Ssl (org.glassfish.appclient.client.acc.config.Ssl)1