Commit 978fc0a3 authored by Brian Major's avatar Brian Major
Browse files

s1890 - corrected internal service lookup

parent fed4862a
Loading
Loading
Loading
Loading
+15 −13
Original line number Diff line number Diff line
@@ -68,22 +68,24 @@

package ca.nrc.cadc.ac.server.web;

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;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.Set;

import javax.security.auth.Subject;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
import java.util.Set;

import org.apache.log4j.Logger;

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
@@ -95,7 +97,7 @@ public class WhoAmIServlet extends HttpServlet
{
    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.
@@ -164,7 +166,7 @@ public class WhoAmIServlet extends HttpServlet
        final RegistryClient registryClient = getRegistryClient();
        final URL redirectURL =
                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.
        final String redirectUrl =
+3 −0
Original line number Diff line number Diff line
@@ -166,6 +166,9 @@ public class UserClient
	        // augment subject calls are always https with client certs
	        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());
	        ByteArrayOutputStream out = new ByteArrayOutputStream();
	        HttpDownload download = new HttpDownload(getUserURL, out);