Authenticating a user under a given suffix without using his DN

Odpowiedz Authenticating a user under a given suffix without using his DN

  • 15 maja 2012 19:51
     
      Zawiera kod

    Good afternoon,

    I'm still struggling with LDAP authentication. I have a Directory Server (Oracle DSEE 7) with two suffixes (say, o=test1 and o=test2) . I have users under both suffixes.

    Say I wanted to authenticate a user under test1 (dn: uid=grajea01,ou=people,o=test1), the following code would work if I'd use the whole DN, but not when using only the uid.

    What I'd want is to be able to pass o=test1 as a parameter somewhere so I'd only need the uid, not the whole user dn.

    Here's the code I'm using and that works with the whole dn (below) . The creds structure contains the server's IP address, port number, username (user's dn), and password. Instead of passing

    uid=grajea01,ou=people,o=test1, I'd like to simply use uid=grajea01 and that the connection be established while using o=test1. Any help would be appreciated !

    -- Jeff

    NetworkCredential nc =new NetworkCredential(creds.UID, creds.Passwd); LdapConnection conn =new LdapConnection(new LdapDirectoryIdentifier(creds.Host, creds.Port, falsefalse)); conn.AuthType =AuthType.Basic; conn.Credential = nc; conn.SessionOptions.ProtocolVersion =3;

    try { conn.Bind(); }

    -EDIT-

    To be a bit more clear on what I'd like:

    Instead of passing creds.UID="uid=grajea01,ou=people,o=test1") to my method, I'd pass creds.UID="grajea01" and creds.host="DS-server/o=test1/", creds.port="389", or something similar.

    thanks

Wszystkie odpowiedzi