* @return The JNDI attributes of the user.
*/
public Attributes getLDAPAttributes()
throws NamingException
{
Attributes attribs = new BasicAttributes();
String attrName;
// Set the objectClass
attrName = "objectClass";
if (attrName != null)
{
Object value = "turbineUser";
if (value != null)
{
Attribute attr = new BasicAttribute(attrName, value);
attribs.put(attr);
}
}
// Set the User id.
attrName = LDAPSecurityConstants.getUserIdAttribute();
if (attrName != null)
{
Object value = getPrimaryKey();
if (value != null)
{
Attribute attr = new BasicAttribute(attrName, value);
attribs.put(attr);
}
}
// Set the Username.
attrName = LDAPSecurityConstants.getNameAttribute();
if (attrName != null)
{
Object value = getName();
if (value != null)
{
Attribute attr = new BasicAttribute(attrName, value);
attribs.put(attr);
}
}
// Set the Firstname.
attrName = LDAPSecurityConstants.getFirstNameAttribute();
if (attrName != null)
{
Object value = getFirstName();
if (value != null)
{
Attribute attr = new BasicAttribute(attrName, value);
attribs.put(attr);
}
}
// Set the Lastname.
attrName = LDAPSecurityConstants.getLastNameAttribute();
if (attrName != null)
{
Object value = getLastName();
if (value != null)
{
Attribute attr = new BasicAttribute(attrName, value);
attribs.put(attr);
}
}
// Set the E-Mail.
attrName = LDAPSecurityConstants.getEmailAttribute();
if (attrName != null)
{
Object value = getEmail();
if (value != null)
{
Attribute attr = new BasicAttribute(attrName, value);
attribs.put(attr);
}
}
// Set the Password
attrName = LDAPSecurityConstants.getPasswordAttribute();
if (attrName != null)
{
Object value = getPassword();
if (value != null)
{
Attribute attr = new BasicAttribute(attrName, value);
attribs.put(attr);
}
}
return attribs;
}