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

Merge branch 's1689' of /usr/cadc/dev/git/wopencadc into nep110

parents 9527e05a b9dd71bd
No related branches found
No related tags found
No related merge requests found
...@@ -68,16 +68,16 @@ ...@@ -68,16 +68,16 @@
*/ */
package ca.nrc.cadc.ac.server; package ca.nrc.cadc.ac.server;
import ca.nrc.cadc.ac.IdentityType; import java.security.Principal;
import java.util.List;
import org.apache.log4j.Logger;
import ca.nrc.cadc.ac.Role; import ca.nrc.cadc.ac.Role;
import ca.nrc.cadc.auth.AuthenticationUtil; import ca.nrc.cadc.auth.AuthenticationUtil;
import ca.nrc.cadc.uws.Parameter; import ca.nrc.cadc.uws.Parameter;
import ca.nrc.cadc.uws.ParameterUtil; import ca.nrc.cadc.uws.ParameterUtil;
import java.security.Principal;
import java.util.List;
import org.apache.log4j.Logger;
/** /**
* Request Validator. This class extracts and validates the ID, TYPE, ROLE * Request Validator. This class extracts and validates the ID, TYPE, ROLE
* and GURI parameters. * and GURI parameters.
......
...@@ -407,11 +407,9 @@ public class LdapUserDAO<T extends Principal> extends LdapDAO ...@@ -407,11 +407,9 @@ public class LdapUserDAO<T extends Principal> extends LdapDAO
throw new IllegalArgumentException( throw new IllegalArgumentException(
"Unsupported principal type " + user.getUserID().getClass()); "Unsupported principal type " + user.getUserID().getClass());
} }
String name = getUserName(searchField, user);
searchField = "(" + searchField + "=" + searchField = "(" + searchField + "=" +
name + ")"; user.getUserID().getName() + ")";
SearchResultEntry searchResult = null; SearchResultEntry searchResult = null;
try try
...@@ -430,32 +428,11 @@ public class LdapUserDAO<T extends Principal> extends LdapDAO ...@@ -430,32 +428,11 @@ public class LdapUserDAO<T extends Principal> extends LdapDAO
if (searchResult == null) if (searchResult == null)
{ {
String msg = "User not found " + name; String msg = "User not found " + user.getUserID().getName();
logger.debug(msg); logger.debug(msg);
throw new UserNotFoundException(msg); throw new UserNotFoundException(msg);
} }
return searchResult.getAttributeValueAsDN("entrydn"); return searchResult.getAttributeValueAsDN("entrydn");
} }
/**
* If the principal is of type x500, canonize the name for the
* search.
*
* @param searchField
* @param user
* @return
*/
private String getUserName(String searchField, User<? extends Principal> user)
{
if (searchField != null)
{
if (searchField.equals("distinguishedname"))
{
return AuthenticationUtil.canonizeDistinguishedName(user.getUserID().getName());
}
return user.getUserID().getName();
}
return null;
}
} }
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