private static Server startServer(ManagementContext mgmt, ContextHandler context, String summary, boolean disableHighAvailability) {
boolean secure = mgmt != null && !BrooklynWebConfig.hasNoSecurityOptions(mgmt.getConfig());
if (secure) {
log.debug("Detected security configured, launching server on all network interfaces");
} else {
log.debug("Detected no security configured, launching server on loopback (localhost) network interface only");
if (mgmt!=null) {
log.debug("Detected no security configured, running on loopback; disabling authentication");
((BrooklynProperties)mgmt.getConfig()).put(BrooklynWebConfig.SECURITY_PROVIDER_CLASSNAME, AnyoneSecurityProvider.class.getName());
}
}
if (mgmt != null && disableHighAvailability)
mgmt.getHighAvailabilityManager().disabled();
InetSocketAddress bindLocation = new InetSocketAddress(
secure ? Networking.ANY_NIC : Networking.LOOPBACK,
Networking.nextAvailablePort(FAVOURITE_PORT));
return startServer(mgmt, context, summary, bindLocation);
}