private String getOmeroDN(long id) { try { String dn = ldapUtil.lookupLdapAuthExperimenter(id); if (log.isDebugEnabled()) { log.debug(String.format("lookupLdap(%s)=%s", id, dn)); } return dn; } catch (ApiUsageException e) { if (log.isDebugEnabled()) { log.debug(String.format("lookupLdap(%s) is empty", id)); } return null; } }
@RolesAllowed("user") public String lookupLdapAuthExperimenter(long id) { return ldapUtil.lookupLdapAuthExperimenter(id); }
/** * Queries the LDAP server and returns the DN for all OMERO users that have * the <code>ldap</code> flag enabled. * * @return a list of DN to user ID maps. */ public List<Map<String, Object>> lookupLdapAuthExperimenters() { List<Long> ldapExperimenters = sql.getLdapExperimenters(); List<Map<String, Object>> rv = Lists .newArrayListWithExpectedSize(ldapExperimenters.size()); for (Long id : ldapExperimenters) { Map<String, Object> values = Maps.newHashMap(); // This will break whenever the mapping in AdminI changes try { values.put("dn", lookupLdapAuthExperimenter(id)); } catch (ApiUsageException aue) { values.put("dn", "ERROR"); } values.put("experimenter_id", id); rv.add(values); } return rv; }
/** * Only returns if the user is already in the database and has a DN value in * the password table. Note: after a call to * {@link #checkPassword(String, String, boolean)} with this same user value, this * method might begin to return {@code true} due to a call to * {@link LdapImpl#createUser(String, String)}. */ @Override public boolean hasPassword(String user) { if (ldapUtil.getSetting()) { Long id = util.userId(user); if (id != null) { String dn = ldapUtil.lookupLdapAuthExperimenter(id); if (dn != null) { return true; } } } return false; }
/** * Only returns if the user is already in the database and has a DN value in * the password table. Note: after a call to * {@link #checkPassword(String, String,boolean)} with this same user value, this * method might begin to return {@code true} due to a call to * {@link LdapImpl#createUser(String, String)}. */ @Override public boolean hasPassword(String user) { if (ldapUtil.getSetting()) { Long id = util.userId(user); if (id != null) { String dn = ldapUtil.lookupLdapAuthExperimenter(id); if (dn != null) { return true; } } } return false; }
String dn = ldapUtil.lookupLdapAuthExperimenter(id); if (dn != null) { return loginAttempt(user,