import javax.security.auth.x500.X500Principal;
import org.argeo.ArgeoException;
-import org.argeo.cms.CmsException;
import org.argeo.cms.CmsView;
import org.argeo.cms.auth.AuthConstants;
import org.argeo.cms.auth.CurrentUser;
Subject subject = Subject.getSubject(AccessController.getContext());
if (subject != null)
return subject;
- throw new CmsException("Cannot find related subject");
+ throw new RuntimeException("Cannot find related subject");
}
// HOME MANAGEMENT
// HELPERS TO RETRIEVE REMARKABLE PROPERTIES
/** Simply retrieves the user uid from his dn with no useradmin */
public static String getUserUid(String dn) {
- try {
- LdapName ldapName = new LdapName(dn);
- Rdn last = ldapName.getRdn(ldapName.size() - 1);
- if (last.getType().toLowerCase().equals(LdifName.uid.name())
- || last.getType().toLowerCase().equals(LdifName.cn.name()))
- return (String) last.getValue();
- else
- throw new ArgeoException("Cannot retrieve user uid, "
- + "non valid dn: " + dn);
- } catch (InvalidNameException e) {
- throw new ArgeoException("Cannot parse LDAP name " + dn, e);
- }
+ LdapName ldapName = getLdapName(dn);
+ Rdn last = ldapName.getRdn(ldapName.size() - 1);
+ if (last.getType().toLowerCase().equals(LdifName.uid.name())
+ || last.getType().toLowerCase().equals(LdifName.cn.name()))
+ return (String) last.getValue();
+ else
+ throw new ArgeoException("Cannot retrieve user uid, "
+ + "non valid dn: " + dn);
}
/**