private ManagementRESTServiceConfiguration getDefaultClusteredManagementRESTServiceConfiguration(Configuration configuration) { ManagementRESTServiceConfiguration managementRESTService; managementRESTService = new ManagementRESTServiceConfiguration(); String url = configuration.getTerracottaConfiguration().getUrl(); if (url != null && url.contains("@")) { managementRESTService.setSslEnabled(true); } managementRESTService.setEnabled(true); managementRESTService.setBind(ManagementRESTServiceConfiguration.NO_BIND); managementRESTService.setSecurityServiceLocation(ManagementRESTServiceConfiguration.AUTO_LOCATION); return managementRESTService; }
private void assertManagementRESTServiceConfigurationIsCorrect(Configuration configuration) { ManagementRESTServiceConfiguration managementRESTService = configuration.getManagementRESTService(); if (managementRESTService == null || !managementRESTService.isEnabled()) { return; } String url = configuration.getTerracottaConfiguration() != null ? configuration.getTerracottaConfiguration().getUrl() : null; boolean connectingToSecureCluster = url != null && url.contains("@"); if (connectingToSecureCluster && !managementRESTService.isSslEnabled()) { throw new InvalidConfigurationException("The REST agent cannot be bound to a port when SSL is disabled and" + " connecting to a secure cluster. Change your configuration to" + " <ManagementRESTServiceConfiguration sslEnabled=\"true\" .../>" + " or remove the ManagementRESTServiceConfiguration element."); } if (connectingToSecureCluster && managementRESTService.getSecurityServiceLocation() == null) { managementRESTService.setSecurityServiceLocation(ManagementRESTServiceConfiguration.AUTO_LOCATION); LOG.warn("The REST agent must have a non-null Security Service Location when SSL is enabled." + " Using ManagementRESTServiceConfiguration.AUTO_LOCATION as a connection to a secure cluster" + " is configured."); } if (managementRESTService.isSslEnabled() && managementRESTService.getSecurityServiceLocation() == null) { throw new InvalidConfigurationException("The REST agent must have a non-null Security Service Location when" + " SSL is enabled. Change your configuration to" + " <ManagementRESTServiceConfiguration securityServiceLocation=\"...\" .../>."); } }
private ManagementRESTServiceConfiguration getDefaultClusteredManagementRESTServiceConfiguration(Configuration configuration) { ManagementRESTServiceConfiguration managementRESTService; managementRESTService = new ManagementRESTServiceConfiguration(); String url = configuration.getTerracottaConfiguration().getUrl(); if (url != null && url.contains("@")) { managementRESTService.setSslEnabled(true); } managementRESTService.setEnabled(true); managementRESTService.setBind(ManagementRESTServiceConfiguration.NO_BIND); managementRESTService.setSecurityServiceLocation(ManagementRESTServiceConfiguration.AUTO_LOCATION); return managementRESTService; }
private ManagementRESTServiceConfiguration getDefaultClusteredManagementRESTServiceConfiguration(Configuration configuration) { ManagementRESTServiceConfiguration managementRESTService; managementRESTService = new ManagementRESTServiceConfiguration(); String url = configuration.getTerracottaConfiguration().getUrl(); if (url != null && url.contains("@")) { managementRESTService.setSslEnabled(true); } managementRESTService.setEnabled(true); managementRESTService.setBind(ManagementRESTServiceConfiguration.NO_BIND); managementRESTService.setSecurityServiceLocation(ManagementRESTServiceConfiguration.AUTO_LOCATION); return managementRESTService; }
private void assertManagementRESTServiceConfigurationIsCorrect(Configuration configuration) { ManagementRESTServiceConfiguration managementRESTService = configuration.getManagementRESTService(); if (managementRESTService == null || !managementRESTService.isEnabled()) { return; } String url = configuration.getTerracottaConfiguration() != null ? configuration.getTerracottaConfiguration().getUrl() : null; boolean connectingToSecureCluster = url != null && url.contains("@"); if (connectingToSecureCluster && !managementRESTService.isSslEnabled()) { throw new InvalidConfigurationException("The REST agent cannot be bound to a port when SSL is disabled and" + " connecting to a secure cluster. Change your configuration to" + " <ManagementRESTServiceConfiguration sslEnabled=\"true\" .../>" + " or remove the ManagementRESTServiceConfiguration element."); } if (connectingToSecureCluster && managementRESTService.getSecurityServiceLocation() == null) { managementRESTService.setSecurityServiceLocation(ManagementRESTServiceConfiguration.AUTO_LOCATION); LOG.warn("The REST agent must have a non-null Security Service Location when SSL is enabled." + " Using ManagementRESTServiceConfiguration.AUTO_LOCATION as a connection to a secure cluster" + " is configured."); } if (managementRESTService.isSslEnabled() && managementRESTService.getSecurityServiceLocation() == null) { throw new InvalidConfigurationException("The REST agent must have a non-null Security Service Location when" + " SSL is enabled. Change your configuration to" + " <ManagementRESTServiceConfiguration securityServiceLocation=\"...\" .../>."); } }
@Override public void initialize(ManagementRESTServiceConfiguration configuration) { // Clear settings that are invalid for non-ee management servers configuration.setNeedClientAuth(false); configuration.setSecurityServiceLocation(null); configuration.setSslEnabled(false); configuration.setSecurityServiceTimeout(0); String host = configuration.getHost(); int port = configuration.getPort(); loadEmbeddedAgentServiceLocator(configuration); ServiceLoader<ApplicationEhCacheService> loaders = applicationEhCacheServiceLoader(); for (ApplicationEhCacheService applicationEhCacheService : loaders) { Class<ManagementServerLifecycle> clazz = applicationEhCacheService.getManagementServerLifecyle(); managementServerLifecycles.add(ServiceLocator.locate(clazz)); } List<FilterDetail> filterDetails = Collections.singletonList(new FilterDetail(new NoIaFilter(), "/*")); standaloneServer = new StandaloneServer(filterDetails, null, "com.terracotta.management.ApplicationEhCache", host, port, null, false); }
private void assertManagementRESTServiceConfigurationIsCorrect(Configuration configuration) { ManagementRESTServiceConfiguration managementRESTService = configuration.getManagementRESTService(); if (managementRESTService == null || !managementRESTService.isEnabled()) { return; } String url = configuration.getTerracottaConfiguration() != null ? configuration.getTerracottaConfiguration().getUrl() : null; boolean connectingToSecureCluster = url != null && url.contains("@"); if (connectingToSecureCluster && !managementRESTService.isSslEnabled()) { throw new InvalidConfigurationException("The REST agent cannot be bound to a port when SSL is disabled and" + " connecting to a secure cluster. Change your configuration to" + " <ManagementRESTServiceConfiguration sslEnabled=\"true\" .../>" + " or remove the ManagementRESTServiceConfiguration element."); } if (connectingToSecureCluster && managementRESTService.getSecurityServiceLocation() == null) { managementRESTService.setSecurityServiceLocation(ManagementRESTServiceConfiguration.AUTO_LOCATION); LOG.warn("The REST agent must have a non-null Security Service Location when SSL is enabled." + " Using ManagementRESTServiceConfiguration.AUTO_LOCATION as a connection to a secure cluster" + " is configured."); } if (managementRESTService.isSslEnabled() && managementRESTService.getSecurityServiceLocation() == null) { throw new InvalidConfigurationException("The REST agent must have a non-null Security Service Location when" + " SSL is enabled. Change your configuration to" + " <ManagementRESTServiceConfiguration securityServiceLocation=\"...\" .../>."); } }