|
Jive Messenger 2.2.2 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jivesoftware.messenger.ldap.LdapManager
public class LdapManager
Centralized administration of LDAP connections. The getInstance() method should be used to get an instace. The following properties configure this manager:
Method Summary | |
---|---|
boolean |
checkAuthentication(String userDN,
String password)
Returns true if the user is able to successfully authenticate against the LDAP server. |
String |
findUserDN(String username)
Finds a user's dn using their username. |
String |
findUserDN(String username,
String baseDN)
Finds a user's dn using their username in the specified baseDN. |
String |
getAdminDN()
Returns the starting admin DN that searches for admins will performed with. |
String |
getAdminPassword()
Returns the starting admin DN that searches for admins will performed with. |
String |
getAlternateBaseDN()
Returns the alternate starting DN that searches for users will performed with. |
String |
getBaseDN()
Returns the starting DN that searches for users will performed with. |
LdapContext |
getContext()
Returns a DirContext for the LDAP server that can be used to perform lookups and searches using the default base DN. |
LdapContext |
getContext(String baseDN)
Returns a DirContext for the LDAP server that can be used to perform lookups and searches using the specified base DN. |
String |
getEmailField()
Returns the LDAP field name that the user's email address is stored in. |
String |
getGroupDescriptionField()
Return the field used to describe a group. |
String |
getGroupMemberField()
Return the field used to list members within a group. |
String |
getGroupNameField()
Returns the field name used for groups. |
String |
getGroupSearchFilter()
Return the field used as the search filter when searching for groups. |
String |
getHost()
Returns the LDAP server host; e.g. |
static LdapManager |
getInstance()
Provides singleton access to an instance of the LdapManager class. |
String |
getNameField()
Returns the LDAP field name that the user's name is stored in. |
int |
getPort()
Returns the LDAP server port number. |
String |
getSearchFilter()
Returns the filter used for searching the directory for users. |
String |
getUsernameField()
Returns the LDAP field name that the username lookup will be performed on. |
boolean |
isDebugEnabled()
Returns true if LDAP connection debugging is turned on. |
boolean |
isPosixMode()
Return true if the LDAP server is operating in Posix mode. |
boolean |
isSslEnabled()
Returns true if LDAP connection is via SSL or not. |
void |
setAdminDN(String adminDN)
Sets the starting admin DN that searches for admins will performed with. |
void |
setAdminPassword(String adminPassword)
Sets the admin password for the LDAP server we're connecting to. |
void |
setAlternateBaseDN(String alternateBaseDN)
Sets the alternate starting DN that searches for users will performed with. |
void |
setBaseDN(String baseDN)
Sets the starting DN that searches for users will performed with. |
void |
setDebugEnabled(boolean debugEnabled)
Sets whether LDAP connection debugging is turned on. |
void |
setEmailField(String emailField)
Sets the LDAP field name that the user's email address is stored in. |
void |
setGroupDescriptionField(String groupDescriptionField)
Sets the field used to describe a group. |
void |
setGroupmemberField(String groupMemberField)
Sets the field used to list members within a group. |
void |
setGroupNameField(String groupNameField)
Sets the field name used for groups. |
void |
setGroupSearchFilter(String groupSearchFilter)
Sets the field used as the search filter when searching for groups. |
void |
setHost(String host)
Sets the LDAP server host; e.g., localhost or machine.example.com, etc. |
void |
setNameField(String nameField)
Sets the LDAP field name that the user's name is stored in. |
void |
setPort(int port)
Sets the LDAP server port number. |
void |
setPostfixMode(boolean posixMode)
Sets whether the LDAP server is operating in Posix mode. |
void |
setSearchFilter(String searchFilter)
Sets the filter used for searching the directory for users. |
void |
setSslEnabled(boolean sslEnabled)
Sets whether the connection to the LDAP server should be made via ssl or not. |
void |
setUsernameField(String usernameField)
Sets the LDAP field name that the username lookup will be performed on. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static LdapManager getInstance()
public LdapContext getContext() throws NamingException
NamingException
- if there is an error making the LDAP connection.public LdapContext getContext(String baseDN) throws NamingException
baseDN
- the base DN to use for the context.
NamingException
- if there is an error making the LDAP connection.public boolean checkAuthentication(String userDN, String password)
userDN
- the user's dn to authenticate (relative to baseDN).password
- the user's password.
public String findUserDN(String username) throws Exception
Searches are performed over all subtrees relative to the baseDN. If the search fails in the baseDN then another search will be performed in the alternateBaseDN. For example, if the baseDN is "o=jivesoftware, o=com" and we do a search for "mtucker", then we might find a userDN of "uid=mtucker,ou=People". This kind of searching is a good thing since it doesn't make the assumption that all user records are stored in a flat structure. However, it does add the requirement that "uid" field (or the other field specified) must be unique over the entire subtree from the baseDN. For example, it's entirely possible to create two dn's in your LDAP directory with the same uid: "uid=mtucker,ou=People" and "uid=mtucker,ou=Administrators". In such a case, it's not possible to uniquely identify a user, so this method will throw an error.
The dn that's returned is relative to the default baseDN.
username
- the username to lookup the dn for.
Exception
- if the search for the dn fails.public String findUserDN(String username, String baseDN) throws Exception
Searches are performed over all subtrees relative to the baseDN. For example, if the baseDN is "o=jivesoftware, o=com" and we do a search for "mtucker", then we might find a userDN of "uid=mtucker,ou=People". This kind of searching is a good thing since it doesn't make the assumption that all user records are stored in a flat structure. However, it does add the requirement that "uid" field (or the other field specified) must be unique over the entire subtree from the baseDN. For example, it's entirely possible to create two dn's in your LDAP directory with the same uid: "uid=mtucker,ou=People" and "uid=mtucker,ou=Administrators". In such a case, it's not possible to uniquely identify a user, so this method will throw an error.
The dn that's returned is relative to the baseDN.
username
- the username to lookup the dn for.baseDN
- the base DN to use for this search.
Exception
- if the search for the dn fails.to search using the default baseDN and alternateBaseDN.
public String getHost()
public void setHost(String host)
host
- the LDAP server host name.public int getPort()
public void setPort(int port)
port
- the LDAP server port number.public boolean isDebugEnabled()
public void setDebugEnabled(boolean debugEnabled)
debugEnabled
- true if debugging should be turned on.public boolean isSslEnabled()
public void setSslEnabled(boolean sslEnabled)
sslEnabled
- true if ssl should be enabled, false otherwise.public String getUsernameField()
public void setUsernameField(String usernameField)
usernameField
- the LDAP field that the username lookup will be
performed on.public String getNameField()
public void setNameField(String nameField)
nameField
- the LDAP field that that correspond's to the user's name.public String getEmailField()
public void setEmailField(String emailField)
emailField
- the LDAP field that that correspond's to the user's
email address.public String getBaseDN()
public void setBaseDN(String baseDN)
baseDN
- the starting DN used for performing searches.public String getAlternateBaseDN()
public void setAlternateBaseDN(String alternateBaseDN)
alternateBaseDN
- the alternate starting DN used for performing searches.public String getAdminDN()
public void setAdminDN(String adminDN)
adminDN
- the starting DN used for performing admin searches.public String getAdminPassword()
public void setAdminPassword(String adminPassword)
adminPassword
- the admin password for the LDAP server we're
connecting to.public String getSearchFilter()
public void setSearchFilter(String searchFilter)
searchFilter
- the search filter.public String getGroupNameField()
public void setGroupNameField(String groupNameField)
groupNameField
- the field used for groups.public String getGroupMemberField()
public void setGroupmemberField(String groupMemberField)
groupMemberField
- the field used to list members within a group.public String getGroupDescriptionField()
public void setGroupDescriptionField(String groupDescriptionField)
groupDescriptionField
- the field used to describe a group.public boolean isPosixMode()
public void setPostfixMode(boolean posixMode)
posixMode
- true if posix mode is being used by the LDAP server.public String getGroupSearchFilter()
public void setGroupSearchFilter(String groupSearchFilter)
groupSearchFilter
- the field used as the search filter when searching for groups.
|
Jive Messenger 2.2.2 Javadoc | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |