/** * Returns a DN for the supplied user by applying it to a format string. * * @param user to format dn for * * @return user DN * * @throws LdapException never */ @Override public String resolve(final String user) throws LdapException { String dn = null; if (user != null && !"".equals(user)) { final String escapedUser = escapeUser ? LdapAttribute.escapeValue(user) : user; logger.debug("Formatting DN for {} with {}", escapedUser, formatString); if (formatArgs != null && formatArgs.length > 0) { final Object[] args = new Object[formatArgs.length + 1]; args[0] = escapedUser; System.arraycopy(formatArgs, 0, args, 1, formatArgs.length); dn = String.format(formatString, args); } else { dn = String.format(formatString, escapedUser); } } else { logger.debug("User input was empty or null"); } return dn; }
/** * Returns a DN for the supplied user by applying it to a format string. * * @param user to format dn for * * @return user DN * * @throws LdapException never */ @Override public String resolve(final User user) throws LdapException { String dn = null; if (user != null && user.getIdentifier() != null && !"".equals(user.getIdentifier())) { final String escapedUser = escapeUser ? LdapAttribute.escapeValue(user.getIdentifier()) : user.getIdentifier(); logger.debug("Formatting DN for {} with {}", escapedUser, formatString); if (formatArgs != null && formatArgs.length > 0) { final Object[] args = new Object[formatArgs.length + 1]; args[0] = escapedUser; System.arraycopy(formatArgs, 0, args, 1, formatArgs.length); dn = String.format(formatString, args); } else { dn = String.format(formatString, escapedUser); } } else { logger.debug("User input was empty or null"); } return dn; }
/** * Returns a DN for the supplied user by applying it to a format string. * * @param user to format dn for * * @return user DN * * @throws LdapException never */ @Override public String resolve(final User user) throws LdapException { String dn = null; if (user != null && user.getIdentifier() != null && !"".equals(user.getIdentifier())) { final String escapedUser = escapeUser ? LdapAttribute.escapeValue(user.getIdentifier()) : user.getIdentifier(); logger.debug("Formatting DN for {} with {}", escapedUser, formatString); if (formatArgs != null && formatArgs.length > 0) { final Object[] args = new Object[formatArgs.length + 1]; args[0] = escapedUser; System.arraycopy(formatArgs, 0, args, 1, formatArgs.length); dn = String.format(formatString, args); } else { dn = String.format(formatString, escapedUser); } } else { logger.debug("User input was empty or null"); } return dn; }