use of edu.uiuc.ncsa.security.util.ssl.SSLKeystoreConfiguration in project OA4MP by ncsa.
the class MyProxyFacadeProvider method get.
@Override
public MyProxyServiceFacade get() {
ServiceFacadeConfiguration sfc;
HashMap<String, Integer> loas = new HashMap<String, Integer>();
String localhostname = null;
String serverDN = null;
try {
localhostname = java.net.InetAddress.getLocalHost().getCanonicalHostName();
} catch (UnknownHostException e) {
localhostname = "localhost";
}
// start with default port.
int port = 7512;
// start with default
long socketTimeout = 0L;
if (getConfig() == null) {
// No configuration, so use the defaults.
sfc = new ServiceFacadeConfiguration(localhostname, port, socketTimeout, loas, serverDN);
// return new MyProxyServiceFacade(sfc);
} else {
serverDN = getAttribute(MYPROXY_SERVER_DN);
if (serverDN == null && hasDefaultServerDN()) {
serverDN = getDefaultServerDN();
}
try {
port = getIntAttribute(MYPROXY_PORT);
} catch (Throwable t) {
// do nothing. If the port is not given, use the default
}
try {
socketTimeout = getIntAttribute(MYPROXY_SOCKET_TIMEOUT);
} catch (Throwable t) {
// do nix.
}
if (getAttribute(MYPROXY_HOST) != null) {
localhostname = getAttribute(MYPROXY_HOST);
}
sfc = new ServiceFacadeConfiguration(localhostname, port, socketTimeout, loas, serverDN);
List list = getConfig().getChildren(MYPROXY_LOA);
if (!list.isEmpty()) {
for (Object obj : list) {
ConfigurationNode cn = (ConfigurationNode) obj;
loas.put(Configurations.getFirstAttribute(cn, MYPROXY_LOA_NAME), Integer.parseInt(Configurations.getFirstAttribute(cn, MYPROXY_LOA_PORT)));
}
}
}
// Unless there is something very exotic about your setup, a basic configuration that
// points to the standard keystore available in java should be more than sufficient.
SSLKeystoreConfiguration sslKeystoreConfiguration = SSLConfigurationUtil.getSSLConfiguration(null, getConfig());
return new MyProxyServiceFacade(sfc, sslKeystoreConfiguration);
}
Aggregations