Search in sources :

Example 1 with Password

use of net.sourceforge.myvd.types.Password in project OpenUnison by TremoloSecurity.

the class MyVDConnection method bind.

public void bind(String dn, String password) 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(""));
    session.put("MYVD_BINDPASS", new Password());
    BindInterceptorChain chain = new BindInterceptorChain(new DistinguishedName(""), new Password(), 0, core.getGlobalChain(), session, request, core.getRouter());
    chain.nextBind(new DistinguishedName(dn), new Password(password), new LDAPConstraints());
}
Also used : HashMap(java.util.HashMap) DistinguishedName(net.sourceforge.myvd.types.DistinguishedName) LDAPConstraints(com.novell.ldap.LDAPConstraints) BindInterceptorChain(net.sourceforge.myvd.chain.BindInterceptorChain) Password(net.sourceforge.myvd.types.Password)

Example 2 with Password

use of net.sourceforge.myvd.types.Password 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

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