Skip to content
Snippets Groups Projects
Commit 978fc0a3 authored by Brian Major's avatar Brian Major
Browse files

s1890 - corrected internal service lookup

parent fed4862a
No related branches found
No related tags found
No related merge requests found
...@@ -68,22 +68,24 @@ ...@@ -68,22 +68,24 @@
package ca.nrc.cadc.ac.server.web; package ca.nrc.cadc.ac.server.web;
import ca.nrc.cadc.ac.AC; import java.io.IOException;
import ca.nrc.cadc.auth.AuthenticationUtil; import java.net.URI;
import ca.nrc.cadc.auth.HttpPrincipal; import java.net.URL;
import ca.nrc.cadc.log.ServletLogInfo; import java.util.Set;
import ca.nrc.cadc.reg.client.RegistryClient;
import org.apache.log4j.Logger;
import javax.security.auth.Subject; import javax.security.auth.Subject;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URI; import org.apache.log4j.Logger;
import java.net.URL;
import java.util.Set; import ca.nrc.cadc.ac.AC;
import ca.nrc.cadc.auth.AuthenticationUtil;
import ca.nrc.cadc.auth.HttpPrincipal;
import ca.nrc.cadc.log.ServletLogInfo;
import ca.nrc.cadc.reg.client.RegistryClient;
/** /**
* Servlet to handle GET requests asking for the current User. This servlet * Servlet to handle GET requests asking for the current User. This servlet
...@@ -95,7 +97,7 @@ public class WhoAmIServlet extends HttpServlet ...@@ -95,7 +97,7 @@ public class WhoAmIServlet extends HttpServlet
{ {
private static final Logger log = Logger.getLogger(WhoAmIServlet.class); private static final Logger log = Logger.getLogger(WhoAmIServlet.class);
static final String USER_GET_PATH = "/users/%s?idType=HTTP"; static final String USER_GET_PATH = "/%s?idType=HTTP";
/** /**
* Handle a /whoami GET operation. * Handle a /whoami GET operation.
...@@ -164,7 +166,7 @@ public class WhoAmIServlet extends HttpServlet ...@@ -164,7 +166,7 @@ public class WhoAmIServlet extends HttpServlet
final RegistryClient registryClient = getRegistryClient(); final RegistryClient registryClient = getRegistryClient();
final URL redirectURL = final URL redirectURL =
registryClient.getServiceURL( registryClient.getServiceURL(
URI.create(AC.GMS_SERVICE_URI), scheme, USER_GET_PATH); URI.create(AC.UMS_SERVICE_URI + "#users"), scheme, USER_GET_PATH);
// Take the first one. // Take the first one.
final String redirectUrl = final String redirectUrl =
......
...@@ -166,6 +166,9 @@ public class UserClient ...@@ -166,6 +166,9 @@ public class UserClient
// augment subject calls are always https with client certs // augment subject calls are always https with client certs
URL getUserURL = registryClient.getServiceURL(usersURI, "https", path, AuthMethod.CERT); URL getUserURL = registryClient.getServiceURL(usersURI, "https", path, AuthMethod.CERT);
if (getUserURL == null)
throw new IllegalArgumentException("No service endpoint for uri " + usersURI);
log.debug("augmentSubject request to " + getUserURL.toString()); log.debug("augmentSubject request to " + getUserURL.toString());
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
HttpDownload download = new HttpDownload(getUserURL, out); HttpDownload download = new HttpDownload(getUserURL, out);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment