if (loginErrorPage == null) {
throw new AuthException("'loginErrorPage' "
+ "must be supplied as a property in the provider-config "
+ "in the domain.xml file!");
}
ServiceLocator habitat = SecurityServicesUtil.getInstance().getHabitat();
Domain domain = habitat.getService(Domain.class);
NetworkListener adminListener = domain.getServerNamed("server").getConfig().getNetworkConfig().getNetworkListener("admin-listener");
if (restURL.contains(TOKEN_ADMIN_LISTENER_PORT)) {
restURL = restURL.replace(TOKEN_ADMIN_LISTENER_PORT, adminListener.getPort());
}
String host = adminListener.getAddress();
if (! ("localhost".equals(host) || "0.0.0.0".equals(host))){
restURL = restURL.replace("localhost", adminListener.getAddress());
}
//If secure admin is enabled, we need to ensure using https
SecureAdmin secureAdmin = habitat.getService(SecureAdmin.class);
if (restURL.startsWith("http:") && (SecureAdmin.Util.isEnabled(secureAdmin))) {
restURL = restURL.replace("http:", "https:");
}
}
}