use of org.identityconnectors.framework.api.RemoteFrameworkConnectionInfo in project CzechIdMng by bcvsolutions.
the class ConnIdIcConfigurationService method findRemoteConnectorManager.
private ConnectorInfoManager findRemoteConnectorManager(IcConnectorServer server) {
// get all saved remote connector servers
ConnectorInfoManager manager = null;
try {
GuardedString pass = server.getPassword();
if (pass == null) {
throw new InvalidCredentialException();
}
RemoteFrameworkConnectionInfo info = new RemoteFrameworkConnectionInfo(server.getHost(), server.getPort(), new org.identityconnectors.common.security.GuardedString(pass.asString().toCharArray()), server.isUseSsl(), null, server.getTimeout());
// flush remote cache
ConnectorInfoManagerFactory instance = ConnectorInfoManagerFactory.getInstance();
instance.clearRemoteCache();
manager = instance.getRemoteManager(info);
} catch (InvalidCredentialException e) {
throw new IcInvalidCredentialException(server.getHost(), server.getPort(), e);
} catch (ConnectorIOException e) {
throw new IcServerNotFoundException(server.getHost(), server.getPort(), e);
} catch (ConnectorException e) {
throw new IcCantConnectException(server.getHost(), server.getPort(), e);
} catch (Exception e) {
throw new IcRemoteServerException(server.getHost(), server.getPort(), e);
}
return manager;
}
use of org.identityconnectors.framework.api.RemoteFrameworkConnectionInfo in project syncope by apache.
the class ConnIdBundleManagerImpl method initRemote.
private void initRemote(final URI location) {
// 1. Extract conf params for remote connection from given URI
String host = location.getHost();
int port = location.getPort();
GuardedString key = new GuardedString(location.getUserInfo().toCharArray());
boolean useSSL = location.getScheme().equals("connids");
List<TrustManager> trustManagers = new ArrayList<>();
String[] params = StringUtils.isBlank(location.getQuery()) ? null : location.getQuery().split("&");
if (params != null && params.length > 0) {
final String[] trustAllCerts = params[0].split("=");
if (trustAllCerts != null && trustAllCerts.length > 1 && "trustAllCerts".equalsIgnoreCase(trustAllCerts[0]) && "true".equalsIgnoreCase(trustAllCerts[1])) {
trustManagers.add(new X509TrustManager() {
@Override
public void checkClientTrusted(final X509Certificate[] chain, final String authType) throws CertificateException {
// no checks, trust all
}
@Override
public void checkServerTrusted(final X509Certificate[] chain, final String authType) throws CertificateException {
// no checks, trust all
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return null;
}
});
}
}
LOG.debug("Configuring remote connector server:" + "\n\tHost: {}" + "\n\tPort: {}" + "\n\tKey: {}" + "\n\tUseSSL: {}" + "\n\tTrustAllCerts: {}", host, port, key, useSSL, !trustManagers.isEmpty());
RemoteFrameworkConnectionInfo info = new RemoteFrameworkConnectionInfo(host, port, key, useSSL, trustManagers, 60 * 1000);
LOG.debug("Remote connection info: {}", info);
// 2. Get connector info manager
ConnectorInfoManager manager = ConnectorInfoManagerFactory.getInstance().getRemoteManager(info);
if (manager == null) {
throw new NotFoundException("Remote ConnectorInfoManager");
}
connInfoManagers.put(location, manager);
}
Aggregations