Search in sources :

Example 1 with EntrySetSearchResults

use of net.sourceforge.myvd.chain.jdbcLdapImpl.EntrySetSearchResults in project OpenUnison by TremoloSecurity.

the class MyVDConnection method search.

public LDAPSearchResults search(String base, int scope, String filter, ArrayList<String> attributes) throws LDAPException {
    HashMap<Object, Object> request = new HashMap<Object, Object>();
    HashMap<Object, Object> session = new HashMap<Object, Object>();
    session.put(SessionVariables.BOUND_INTERCEPTORS, new ArrayList<String>());
    session.put("MYVD_BINDDN", new DistinguishedName("cn=TremoloAdmin"));
    session.put("MYVD_BINDPASS", new Password());
    ArrayList<net.sourceforge.myvd.types.Attribute> lattribs = new ArrayList<net.sourceforge.myvd.types.Attribute>();
    Iterator<String> it = attributes.iterator();
    while (it.hasNext()) {
        lattribs.add(new net.sourceforge.myvd.types.Attribute(it.next()));
    }
    SearchInterceptorChain chain = new SearchInterceptorChain(new DistinguishedName("cn=TremoloAdmin"), new Password(), 0, core.getGlobalChain(), session, request, core.getRouter());
    DistinguishedName baseDN = new DistinguishedName(base);
    if (filter.contains("\\,")) {
        filter = filter.replaceAll("[\\\\][,]", "\\\\5C,");
    }
    Filter searchFilter = new Filter(filter);
    Results res = new Results(core.getGlobalChain(), 0);
    chain.nextSearch(baseDN, new Int(scope), searchFilter, lattribs, new Bool(false), res, new LDAPSearchConstraints());
    return new EntrySetSearchResults(res);
}
Also used : HashMap(java.util.HashMap) DistinguishedName(net.sourceforge.myvd.types.DistinguishedName) LDAPAttribute(com.novell.ldap.LDAPAttribute) LDAPSearchConstraints(com.novell.ldap.LDAPSearchConstraints) ArrayList(java.util.ArrayList) EntrySetSearchResults(net.sourceforge.myvd.chain.jdbcLdapImpl.EntrySetSearchResults) Int(net.sourceforge.myvd.types.Int) Filter(net.sourceforge.myvd.types.Filter) LDAPSearchResults(com.novell.ldap.LDAPSearchResults) EntrySetSearchResults(net.sourceforge.myvd.chain.jdbcLdapImpl.EntrySetSearchResults) Results(net.sourceforge.myvd.types.Results) Bool(net.sourceforge.myvd.types.Bool) SearchInterceptorChain(net.sourceforge.myvd.chain.SearchInterceptorChain) Password(net.sourceforge.myvd.types.Password)

Aggregations

LDAPAttribute (com.novell.ldap.LDAPAttribute)1 LDAPSearchConstraints (com.novell.ldap.LDAPSearchConstraints)1 LDAPSearchResults (com.novell.ldap.LDAPSearchResults)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 SearchInterceptorChain (net.sourceforge.myvd.chain.SearchInterceptorChain)1 EntrySetSearchResults (net.sourceforge.myvd.chain.jdbcLdapImpl.EntrySetSearchResults)1 Bool (net.sourceforge.myvd.types.Bool)1 DistinguishedName (net.sourceforge.myvd.types.DistinguishedName)1 Filter (net.sourceforge.myvd.types.Filter)1 Int (net.sourceforge.myvd.types.Int)1 Password (net.sourceforge.myvd.types.Password)1 Results (net.sourceforge.myvd.types.Results)1