Skip to content
Snippets Groups Projects
Commit bdca6e1b authored by brinn's avatar brinn
Browse files

change: - allow to specify crowd.server.host and crowd.server.port also in...

change: - allow to specify crowd.server.host and crowd.server.port also in CIFEX and Datamover Console service.properties
- change CrowdAuthenticationService constructor such that it can cope with the port not being set in service.properties (int -> String)
- rename property crowd.server.url to crowd.server.host in service.property of lims)

SVN: 7813
parent 79525f5d
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,8 @@ import ch.systemsx.cisd.common.logging.LogFactory;
* <i>Crowd</i> server, then authenticates the user.
* <p>
* The modus operandi is based on information found at <a
* href="http://confluence.atlassian.com/display/CROWD/SOAP+API">http://confluence.atlassian.com/display/CROWD/SOAP+API</a>
* href="http://confluence.atlassian.com/display/CROWD/SOAP+API"
* >http://confluence.atlassian.com/display/CROWD/SOAP+API</a>
* </p>
*
* @author Franz-Josef Elmer
......@@ -167,14 +168,14 @@ public class CrowdAuthenticationService implements IAuthenticationService
private final IRequestExecutor requestExecutor;
public CrowdAuthenticationService(final String host, final int port, final String application,
final String applicationPassword)
public CrowdAuthenticationService(final String host, final String port,
final String application, final String applicationPassword)
{
this("https://" + host + ":" + port + "/crowd/services/SecurityServer", application,
applicationPassword, createExecutor());
this("https://" + host + ":" + checkPort(port) + "/crowd/services/SecurityServer",
application, applicationPassword, createExecutor());
}
public CrowdAuthenticationService(final String url, final String application,
CrowdAuthenticationService(final String url, final String application,
final String applicationPassword, final IRequestExecutor requestExecutor)
{
this.url = url;
......@@ -190,6 +191,25 @@ public class CrowdAuthenticationService implements IAuthenticationService
}
}
private static String checkPort(String portStr) throws ConfigurationFailureException
{
try
{
// '${' means we have an unresolved Spring variable
if (portStr != null && portStr.startsWith("${") == false)
{
if (Integer.parseInt(portStr) <= 0)
{
throw ConfigurationFailureException.fromTemplate("Illegal port '%s'", portStr);
}
}
} catch (NumberFormatException ex)
{
throw ConfigurationFailureException.fromTemplate("Illegal port '%s'", portStr);
}
return portStr;
}
//
// ISelfTestable
//
......@@ -299,7 +319,8 @@ public class CrowdAuthenticationService implements IAuthenticationService
}
/**
* Parses given <i>Crowd</i> XML response and returns a map of found <code>SOAPAttribute</code>s.
* Parses given <i>Crowd</i> XML response and returns a map of found <code>SOAPAttribute</code>
* s.
* <p>
* Never returns <code>null</code> but could returns an empty <code>Map</code>.
* </p>
......
......@@ -45,7 +45,7 @@ import ch.systemsx.cisd.authentication.Principal;
public class RealCrowdAuthenticationTest
{
private static final int PORT_OF_AUTHENTICATION_SERVICE = 0; // FIX!
private static final String PORT_OF_AUTHENTICATION_SERVICE = null; // FIX!
private static final String HOST_NAME_OF_AUTHENTICATION_SERVICE = null; // FIX!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment