|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.ldap.LDAPMapper
public class LDAPMapper
This class allows simpler access to LDAP using following ldap properties. It is not thread safe, use one LDAPMapper instance per thread.
Field Summary | |
---|---|
protected LDAPConfiguration |
conf
|
protected boolean |
isConnected
|
protected netscape.ldap.LDAPException |
lastException
|
protected netscape.ldap.LDAPConnection |
ldc
|
static String |
REVISION
|
Constructor Summary | |
---|---|
LDAPMapper(LDAPConfiguration conf)
Creates a new mapper and establish the connection using given LDAPConfiguration . |
Method Summary | |
---|---|
boolean |
authenticate(String dn,
String password)
Try to establish a new connection and to authenticate to the ldap server specified in the LDAPConfiguration of this mapper, using the
given dn connect and password. |
void |
disconnect()
Disconnect the underlying LDAPConnection of this mapper. |
ArrayList<netscape.ldap.LDAPEntry> |
getGroupsLDAPEntries(String dn,
String[] attrs)
Return the groups LDAP Entry for the given dn (dn of a user or a sub-group). |
netscape.ldap.LDAPException |
getLastException()
|
netscape.ldap.LDAPConnection |
getLDAPConnection()
Returns the LDAPConnection instance initialized during the construction
of this LDAPMapper . |
ArrayList<netscape.ldap.LDAPEntry> |
getMatchingLDAPEntries(String baseDN,
String searchFilter,
String[] attrs)
Return the matching LDAP Entries for the given login (uses the LDAPConfiguration suffix (search baseDN) and user filter (search filter)). Does not return entries that may be available on referals servers. |
netscape.ldap.LDAPEntry |
getUserLDAPEntry(String login,
String[] attrs)
Return the first matching LDAP Entry for the given login. |
boolean |
isConnected()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
protected final LDAPConfiguration conf
protected final netscape.ldap.LDAPConnection ldc
protected boolean isConnected
protected netscape.ldap.LDAPException lastException
Constructor Detail |
---|
public LDAPMapper(LDAPConfiguration conf)
LDAPConfiguration
. disconnect()
when finished with this mapper. getLastException()
conf
- the LDAPConfiguration to use for this mapperMethod Detail |
---|
public netscape.ldap.LDAPEntry getUserLDAPEntry(String login, String[] attrs)
LDAPConfiguration.getSuffix()
(search baseDN)
- LDAPConfiguration.getUserFilter()
(search filter)
login
- the login of the member of which to retrieve LDAPEntry.attrs
- attributes you want returned in the result.
getLastException()
.
A warning message is logged if more than one entries have been found (in
which case you should refine your user search filter).public ArrayList<netscape.ldap.LDAPEntry> getGroupsLDAPEntries(String dn, String[] attrs)
LDAPConfiguration.getGroupSuffix()
(search baseDN)
- LDAPConfiguration.getGroupFilter()
(search filter)
dn
- the dn of the user of which to retrieve groups' LDAPEntry.attrs
- attributes you want returned in the result.
getLastException()
.public ArrayList<netscape.ldap.LDAPEntry> getMatchingLDAPEntries(String baseDN, String searchFilter, String[] attrs)
baseDN
- the base distinguished name from which to searchsearchFilter
- the searchFilter to use for with method LDAPConnection.search(String, int, String, String[], boolean)
.attrs
- attributes you want returned in the result.
LDAPException
is available using getLastException()
if error occured during search.public boolean authenticate(String dn, String password)
LDAPConfiguration
of this mapper, using the
given dn connect and password.
Disconnect immediately.
dn
- the dn to use to try aupassword
- the password to use for authentication.
getLastException()
public netscape.ldap.LDAPException getLastException()
public netscape.ldap.LDAPConnection getLDAPConnection()
LDAPConnection
instance initialized during the construction
of this LDAPMapper
. isConnected()
. LDAPConnection.disconnect()
method
of the returned LDAPConnection object, instead, call the disconnect()
method of this LDAPMapper
.
public boolean isConnected()
public void disconnect()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |