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

s1890: get a not null principal for logging in CreateUserAction

parent f49e0472
No related branches found
No related tags found
No related merge requests found
......@@ -281,21 +281,25 @@ public class LdapUserDAO extends LdapDAO
{
throw new IllegalArgumentException("No user identities");
}
Principal idForLogging = principals.iterator().next();
if (user.posixDetails != null)
{
throw new UnsupportedOperationException("Support for users PosixDetails not available");
}
Set<X500Principal> x500Principals = user.getIdentities(X500Principal.class);
if (x500Principals.isEmpty())
{
throw new IllegalArgumentException("No user X500Principals found");
}
X500Principal idForLogging = x500Principals.iterator().next();
// check current users
for (Principal p : principals)
{
checkUsers(p, null, config.getUsersDN());
}
Set<X500Principal> x500Principals = user.getIdentities(X500Principal.class);
try
{
long numericID = genNextNumericId();
......
......@@ -70,8 +70,10 @@ package ca.nrc.cadc.ac.server.web.users;
import ca.nrc.cadc.ac.User;
import javax.security.auth.x500.X500Principal;
import java.io.InputStream;
import java.security.AccessControlException;
import java.util.Set;
public class CreateUserAction extends AbstractUserAction
{
......@@ -95,7 +97,12 @@ public class CreateUserAction extends AbstractUserAction
userPersistence.addUser(user);
syncOut.setCode(201);
logUserInfo(user.getHttpPrincipal().getName());
Set<X500Principal> x500Principals = user.getIdentities(X500Principal.class);
if (!x500Principals.isEmpty())
{
X500Principal x500Principal = x500Principals.iterator().next();
logUserInfo(x500Principal.getName());
}
}
}
......@@ -258,7 +258,7 @@ public abstract class UserActionFactory
}
else
{
throw new IllegalArgumentException("Unregonized userid");
throw new IllegalArgumentException("Unrecognized userid");
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment