Search in sources :

Example 6 with ConnectorInfoManager

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;
}
Also used : ConnectorInfoManagerFactory(org.identityconnectors.framework.api.ConnectorInfoManagerFactory) ConnectorInfoManager(org.identityconnectors.framework.api.ConnectorInfoManager) ConnectorClass(org.identityconnectors.framework.spi.ConnectorClass) ArrayList(java.util.ArrayList) ConnectorClass(org.identityconnectors.framework.spi.ConnectorClass) URL(java.net.URL) Reflections(org.reflections.Reflections)

Example 7 with ConnectorInfoManager

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);
}
Also used : ArrayList(java.util.ArrayList) NotFoundException(org.apache.syncope.core.persistence.api.dao.NotFoundException) CertificateException(java.security.cert.CertificateException) GuardedString(org.identityconnectors.common.security.GuardedString) GuardedString(org.identityconnectors.common.security.GuardedString) X509Certificate(java.security.cert.X509Certificate) TrustManager(javax.net.ssl.TrustManager) X509TrustManager(javax.net.ssl.X509TrustManager) ConnectorInfoManager(org.identityconnectors.framework.api.ConnectorInfoManager) X509TrustManager(javax.net.ssl.X509TrustManager) RemoteFrameworkConnectionInfo(org.identityconnectors.framework.api.RemoteFrameworkConnectionInfo)

Example 8 with ConnectorInfoManager

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;
}
Also used : IcConnectorKeyImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorKeyImpl) IcConnectorInfoImpl(eu.bcvsolutions.idm.ic.impl.IcConnectorInfoImpl) ConnectorKey(org.identityconnectors.framework.api.ConnectorKey) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) ConnectorInfo(org.identityconnectors.framework.api.ConnectorInfo) IcConnectorInfo(eu.bcvsolutions.idm.ic.api.IcConnectorInfo) ConnectorInfoManager(org.identityconnectors.framework.api.ConnectorInfoManager) HashSet(java.util.HashSet)

Example 9 with ConnectorInfoManager

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;
}
Also used : ConnectorInfoManager(org.identityconnectors.framework.api.ConnectorInfoManager)

Aggregations

ConnectorInfoManager (org.identityconnectors.framework.api.ConnectorInfoManager)9 ConnectorInfo (org.identityconnectors.framework.api.ConnectorInfo)4 ArrayList (java.util.ArrayList)3 IcConnectorInfo (eu.bcvsolutions.idm.ic.api.IcConnectorInfo)2 IOException (java.io.IOException)2 URL (java.net.URL)2 NotFoundException (org.apache.syncope.core.persistence.api.dao.NotFoundException)2 GuardedString (org.identityconnectors.common.security.GuardedString)2 ConnectorInfoManagerFactory (org.identityconnectors.framework.api.ConnectorInfoManagerFactory)2 ConnectorKey (org.identityconnectors.framework.api.ConnectorKey)2 RemoteFrameworkConnectionInfo (org.identityconnectors.framework.api.RemoteFrameworkConnectionInfo)2 EncryptionException (com.evolveum.midpoint.prism.crypto.EncryptionException)1 ConnIdUtil.processIcfException (com.evolveum.midpoint.provisioning.ucf.impl.connid.ConnIdUtil.processIcfException)1 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)1 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1 CoreException (eu.bcvsolutions.idm.core.api.exception.CoreException)1 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)1 IcCantConnectException (eu.bcvsolutions.idm.ic.exception.IcCantConnectException)1