Skip to content
Snippets Groups Projects
Commit 745ddef3 authored by Jeff Burke's avatar Jeff Burke
Browse files

s1849: cadcAccessControl-Server updates for new RegistryClient.

parent 439b9bfb
Branches
Tags
No related merge requests found
......@@ -116,8 +116,8 @@
<copy overwrite="true" file="test/LdapConfig.test.properties"
todir="${user.home}/config/"/>
<copy overwrite="true"
file="${env.CADC_PREFIX}/etc/LocalAuthority.properties"
tofile="${build}/class/LocalAuthority.properties"/>
file="${env.A}/etc/LocalAuthority.properties"
todir="${build}/test/class/"/>
</target>
<!-- JAR files needed to run the test suite -->
......
......@@ -79,6 +79,8 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import ca.nrc.cadc.auth.AuthMethod;
import ca.nrc.cadc.reg.Standards;
import org.apache.log4j.Logger;
import ca.nrc.cadc.auth.AuthenticationUtil;
......@@ -170,9 +172,8 @@ public class WhoAmIServlet extends HttpServlet
log.debug("ums service uri: " + umsServiceURI);
final URL redirectURL =
registryClient.getServiceURL(
URI.create(umsServiceURI.toString() + "#users"), scheme, USER_GET_PATH);
final URL serviceURL = registryClient.getServiceURL(umsServiceURI, Standards.UMS_USERS_01, AuthMethod.PASSWORD);
final URL redirectURL = new URL(serviceURL.toExternalForm() + USER_GET_PATH);
// Take the first one.
final String redirectUrl =
......@@ -181,8 +182,7 @@ public class WhoAmIServlet extends HttpServlet
log.debug("redirecting to " + redirectURI.toASCIIString());
response.sendRedirect(redirectURI.getPath() + "?"
+ redirectURI.getQuery());
response.sendRedirect(redirectURI.getPath() + "?" + redirectURI.getQuery());
}
/**
......
......@@ -82,6 +82,8 @@ import javax.security.auth.Subject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import ca.nrc.cadc.auth.AuthMethod;
import ca.nrc.cadc.reg.Standards;
import org.junit.Test;
import ca.nrc.cadc.auth.HttpPrincipal;
......@@ -135,9 +137,12 @@ public class WhoAmIServletTest
LocalAuthority localAuthority = new LocalAuthority();
URI umsServiceURI = localAuthority.getServiceURI("ums");
expect(mockRegistry.getServiceURL(URI.create(umsServiceURI.toString() + "#users"),
"http", "/%s?idType=HTTP")).
andReturn(new URL("http://mysite.com/ac/users/CADCtest?idType=HTTP")).once();
// expect(mockRegistry.getServiceURL(URI.create(umsServiceURI.toString() + "#users"),
// "http", "/%s?idType=HTTP")).
// andReturn(new URL("http://mysite.com/ac/users/CADCtest?idType=HTTP")).once();
expect(mockRegistry.getServiceURL(umsServiceURI, Standards.UMS_USERS_01, AuthMethod.PASSWORD))
.andReturn(new URL("http://mysite.com/ac/users")).once();
replay(mockRequest, mockResponse, mockRegistry);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment