| | |
| | | public void initializeConnectionHandler(HTTPConnectionHandlerCfg config) |
| | | throws ConfigException, InitializationException |
| | | { |
| | | this.enabled = config.isEnabled(); |
| | | |
| | | if (friendlyName == null) |
| | | { |
| | | friendlyName = config.dn().rdn().getAttributeValue(0).toString(); |
| | |
| | | // Configure SSL if needed. |
| | | try |
| | | { |
| | | // This call may disable the connector if wrong SSL settings |
| | | configureSSL(config); |
| | | } |
| | | catch (DirectoryException e) |
| | |
| | | |
| | | this.initConfig = config; |
| | | this.currentConfig = config; |
| | | this.enabled = this.currentConfig.isEnabled(); |
| | | } |
| | | |
| | | private String getHandlerName(HTTPConnectionHandlerCfg config) |
| | |
| | | setName(handlerName); |
| | | |
| | | boolean lastIterationFailed = false; |
| | | boolean starting = true; |
| | | |
| | | while (!shutdownRequested) |
| | | { |
| | | // If this connection handler is not enabled, then just sleep |
| | |
| | | stopHttpServer(); |
| | | } |
| | | |
| | | if (starting) |
| | | { |
| | | // This may happen if there was an initialisation error |
| | | // which led to disable the connector. |
| | | // The main thread is waiting for the connector to listen |
| | | // on its port, which will not occur yet, |
| | | // so notify here to allow the server startup to complete. |
| | | synchronized (waitListen) |
| | | { |
| | | starting = false; |
| | | waitListen.notify(); |
| | | } |
| | | } |
| | | |
| | | StaticUtils.sleep(1000); |
| | | continue; |
| | | } |
| | |
| | | DN keyMgrDN = config.getKeyManagerProviderDN(); |
| | | KeyManagerProvider<?> keyManagerProvider = |
| | | DirectoryServer.getKeyManagerProvider(keyMgrDN); |
| | | if (keyManagerProvider == null) |
| | | { |
| | | if (keyManagerProvider == null) { |
| | | logger.error(ERR_NULL_KEY_PROVIDER_MANAGER, keyMgrDN, friendlyName); |
| | | logger.warn(INFO_DISABLE_CONNECTION, friendlyName); |
| | | keyManagerProvider = new NullKeyManagerProvider(); |
| | | enabled = false; |
| | | } |
| | | else if (! keyManagerProvider.containsAtLeastOneKey()) |
| | | { |
| | | logger.error(ERR_INVALID_KEYSTORE, friendlyName); |
| | | logger.warn(INFO_DISABLE_CONNECTION, friendlyName); |
| | | enabled = false; |
| | | } |
| | | |
| | | String alias = config.getSSLCertNickname(); |
| | |
| | | } |
| | | else |
| | | { |
| | | if (! keyManagerProvider.containsKeyWithAlias(alias)) { |
| | | logger.error(ERR_KEYSTORE_DOES_NOT_CONTAIN_ALIAS, alias, friendlyName); |
| | | logger.warn(INFO_DISABLE_CONNECTION, friendlyName); |
| | | enabled = false; |
| | | } |
| | | keyManagers = |
| | | SelectableCertificateKeyManager.wrap(keyManagerProvider |
| | | .getKeyManagers(), alias); |