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

s1728: WhoAmIServlet fixes.

parent 773fa9a3
No related branches found
No related tags found
No related merge requests found
......@@ -259,7 +259,6 @@ public class UserServlet extends HttpServlet
{
ServletPrincipalExtractor extractor = new ServletPrincipalExtractor(request);
Set<Principal> principals = extractor.getPrincipals();
log.debug("Principals: " + principals);
for (Principal principal : principals)
{
......@@ -267,12 +266,12 @@ public class UserServlet extends HttpServlet
{
if (principal.getName().equalsIgnoreCase(notAugmentedX500User))
{
log.debug("found notAugmentedX500User " + notAugmentedX500User);
return true;
}
}
}
return false;
}
}
......@@ -162,11 +162,13 @@ public class WhoAmIServlet extends HttpServlet
final RegistryClient registryClient = getRegistryClient();
final URL redirectURL =
registryClient.getServiceURL(
URI.create(AC.GMS_SERVICE_URI), "http", USER_GET_PATH);
URI.create(AC.GMS_SERVICE_URI), "https", USER_GET_PATH);
// Take the first one.
response.sendRedirect(String.format(redirectURL.toExternalForm(),
webPrincipal.getName()));
final String redirectUrl =
String.format(redirectURL.toString(), webPrincipal.getName());
log.debug("redirecting to " + redirectUrl);
response.sendRedirect(redirectUrl);
}
/**
......
......@@ -102,9 +102,13 @@ public class AuthenticatorImpl implements Authenticator
*/
public Subject getSubject(Subject subject)
{
log.debug("ac augment subject: " + subject);
AuthMethod am = AuthenticationUtil.getAuthMethod(subject);
if (am == null || AuthMethod.ANON.equals(am))
{
log.debug("returning anon subject");
return subject;
}
if (subject != null && subject.getPrincipals().size() > 0)
{
......@@ -126,14 +130,13 @@ public class AuthenticatorImpl implements Authenticator
protected void augmentSubject(final Subject subject)
{
try
{
LdapUserPersistence<Principal> dao = new LdapUserPersistence<Principal>();
User<Principal> user = dao.getAugmentedUser(subject.getPrincipals().iterator().next());
if (user.getIdentities() != null)
{
log.debug("Found " + user.getIdentities().size() + " principals after agument");
log.debug("Found " + user.getIdentities().size() + " principals after argument");
}
else
{
......@@ -150,7 +153,6 @@ public class AuthenticatorImpl implements Authenticator
{
throw new IllegalStateException("Internal error", e);
}
}
}
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