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