use of org.identityconnectors.framework.api.ConnectorInfoManager in project CzechIdMng by bcvsolutions.
the class ConnIdIcConfigurationService method findAllLocalConnectorManagers.
private List<ConnectorInfoManager> findAllLocalConnectorManagers() {
if (managers == null) {
List<Class<?>> annotated = new ArrayList<>();
// Find all class with annotation IcConnectorClass under specific
// packages
localConnectorsPackages.forEach(packageWithConnectors -> {
Reflections reflections = new Reflections(packageWithConnectors);
annotated.addAll(reflections.getTypesAnnotatedWith(ConnectorClass.class));
});
LOG.info(MessageFormat.format("Found annotated classes with IcConnectorClass [{0}]", annotated));
managers = new ArrayList<>(annotated.size());
for (Class<?> clazz : annotated) {
URL url = clazz.getProtectionDomain().getCodeSource().getLocation();
// Transformation the Url to standard Java Url (for the JBoss VFS problem)
URL resultUrl = toStandardJavaUrl(url);
ConnectorInfoManagerFactory fact = ConnectorInfoManagerFactory.getInstance();
ConnectorInfoManager manager = fact.getLocalManager(resultUrl);
managers.add(manager);
}
LOG.info(MessageFormat.format("Found all local connector managers [{0}]", managers.toString()));
}
return managers;
}
use of org.identityconnectors.framework.api.ConnectorInfoManager 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);
}
use of org.identityconnectors.framework.api.ConnectorInfoManager in project CzechIdMng by bcvsolutions.
the class ConnIdIcConfigurationService method getAvailableLocalConnectors.
/**
* Return available local connectors for this IC implementation
*
* @return
*/
@Override
public Set<IcConnectorInfo> getAvailableLocalConnectors() {
LOG.info("Get Available local connectors - ConnId");
Set<IcConnectorInfo> localConnectorInfos = new HashSet<>();
List<ConnectorInfoManager> managers = findAllLocalConnectorManagers();
LOG.info(MessageFormat.format("Managers of local ConnId connectors [{0}]", managers));
for (ConnectorInfoManager manager : managers) {
List<ConnectorInfo> infos = manager.getConnectorInfos();
if (infos == null) {
continue;
}
for (ConnectorInfo info : infos) {
ConnectorKey key = info.getConnectorKey();
if (key == null) {
continue;
}
IcConnectorKeyImpl keyDto = new IcConnectorKeyImpl(getFramework(), key.getBundleName(), key.getBundleVersion(), key.getConnectorName());
IcConnectorInfoImpl infoDto = new IcConnectorInfoImpl(info.getConnectorDisplayName(), info.getConnectorCategory(), keyDto);
localConnectorInfos.add(infoDto);
}
}
return localConnectorInfos;
}
use of org.identityconnectors.framework.api.ConnectorInfoManager in project midpoint by Evolveum.
the class DirectoryScanningInfoManager method registerConnector.
private boolean registerConnector(URI bundle) {
if (isLoaded(bundle)) {
return false;
}
Optional<ConnectorInfoManager> maybeConnector = connectorFromURL(bundle);
if (maybeConnector.isPresent()) {
ConnectorInfoManager connector = maybeConnector.get();
uriToManager.put(bundle, connector);
managers.add(connector);
return true;
}
return false;
}
Aggregations