|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.xpn.xwiki.plugin.ldap.XWikiLDAPConnection
public class XWikiLDAPConnection
LDAP communication tool.
Constructor Summary | |
---|---|
XWikiLDAPConnection()
|
Method Summary | |
---|---|
void |
bind(String loginDN,
String password)
Bind to LDAP server. |
boolean |
checkPassword(String userDN,
String password)
Check if provided password is correct provided users's password. |
boolean |
checkPassword(String userDN,
String password,
String passwordField)
Check if provided password is correct provided users's password. |
void |
close()
Close LDAP connection. |
static String |
escapeLDAPDNValue(String value)
Fully escape DN value (the part after the =). |
static String |
escapeLDAPSearchFilter(String value)
Escape part of a LDAP query filter. |
com.novell.ldap.LDAPConnection |
getConnection()
|
protected void |
ldapToXWikiAttribute(List<XWikiLDAPSearchAttribute> searchAttributeList,
com.novell.ldap.LDAPAttributeSet attributeSet)
Fill provided searchAttributeList with provided LDAP attributes. |
boolean |
open(String ldapHost,
int ldapPort,
String loginDN,
String password,
String pathToKeys,
boolean ssl,
XWikiContext context)
Open LDAP connection. |
boolean |
open(String ldapUserName,
String password,
XWikiContext context)
Open a LDAP connection. |
com.novell.ldap.LDAPSearchResults |
search(String baseDN,
String filter,
String[] attr,
int ldapScope)
|
List<XWikiLDAPSearchAttribute> |
searchLDAP(String baseDN,
String filter,
String[] attr,
int ldapScope)
Execute a LDAP search query and return the first entry. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XWikiLDAPConnection()
Method Detail |
---|
public com.novell.ldap.LDAPConnection getConnection()
LDAPConnection
.public boolean open(String ldapUserName, String password, XWikiContext context) throws XWikiLDAPException
ldapUserName
- the user name to connect to LDAP server.password
- the password to connect to LDAP server.context
- the XWiki context.
XWikiLDAPException
- error when trying to open connection.public boolean open(String ldapHost, int ldapPort, String loginDN, String password, String pathToKeys, boolean ssl, XWikiContext context) throws XWikiLDAPException
ldapHost
- the host of the server to connect to.ldapPort
- the port of the server to connect to.loginDN
- the user DN to connect to LDAP server.password
- the password to connect to LDAP server.pathToKeys
- the path to SSL keystore to use.ssl
- if true connect using SSL.context
- the XWiki context.
XWikiLDAPException
- error when trying to open connection.public void bind(String loginDN, String password) throws UnsupportedEncodingException, com.novell.ldap.LDAPException
loginDN
- the user DN to connect to LDAP server.password
- the password to connect to LDAP server.
UnsupportedEncodingException
- error when converting provided password to UTF-8 table.
com.novell.ldap.LDAPException
- error when trying to bind.public void close()
public boolean checkPassword(String userDN, String password)
userDN
- the user.password
- the password.
public boolean checkPassword(String userDN, String password, String passwordField)
userDN
- the user.password
- the password.passwordField
- the name of the LDAP field containing the password.
public List<XWikiLDAPSearchAttribute> searchLDAP(String baseDN, String filter, String[] attr, int ldapScope)
baseDN
- the root DN from where to search.filter
- the LDAP filter.attr
- the attributes names of values to return.ldapScope
- the scope of the entries to search. The following are the valid options:
public com.novell.ldap.LDAPSearchResults search(String baseDN, String filter, String[] attr, int ldapScope) throws com.novell.ldap.LDAPException
baseDN
- the root DN from where to search.filter
- filter the LDAP filterattr
- the attributes names of values to returnldapScope
- the scope of the entries to search. The following are the valid options:
com.novell.ldap.LDAPException
- error when searchingprotected void ldapToXWikiAttribute(List<XWikiLDAPSearchAttribute> searchAttributeList, com.novell.ldap.LDAPAttributeSet attributeSet)
searchAttributeList
with provided LDAP attributes.
searchAttributeList
- the XWiki attributes.attributeSet
- the LDAP attributes.public static String escapeLDAPDNValue(String value)
For example, for the dn value "Acme, Inc", the escapeLDAPDNValue method returns "Acme\, Inc".
value
- the DN value to escape
public static String escapeLDAPSearchFilter(String value)
value
- the value to escape
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |