none
Connect to eDirectory using application credentials. Then authenticate user

    Question

  • I need to connect to NetIQ eDirectory using .NET & C#. The connection must be opened using application credentials. Once the connection is opened, I need to validate user credentials under the authority of the application credentials using a similar method as S.DS.AccountManagement.

    using (var context = new PrincipalContext(ContextType.Domain, path, appUserDn, appPassword))
    {
        //Username and password for authentication.
        var valid = context.ValidateCredentials(userDn, password);
    }

    I tried Novell.Directory.Ldap, S.DS.DirectoryEntry, & S.DS.AccountManagement. The last one requires AD and does not apply.

    Test using Novell.Directory.Ldap..

     using (var cn = new LdapConnection())
    {
        cn.Connect(server, int.Parse(port));
        cn.Bind(appUserDn, appPassword); //throws exception if invalid credentials..
        var passwordAttr = new LdapAttribute("userPassword", password);
        cn.Compare(userDn, passwordAttr); // Only compares password, so no locked account check, etc.
    }

    My current prototype uses S.DS.Protocols.

    var networkCredential = new NetworkCredential(
        appUserDn,
        appPassword);
    
    using (proto.LdapConnection cn = new proto.LdapConnection(new proto.LdapDirectoryIdentifier(server, int.Parse(port)), networkCredential, proto.AuthType.Basic))
    {
        cn.Bind();
    
        /// Next validate user credentials..
    
    }

    I cannot find a way to validate user credentials other than reassigning NetworkCrentials and rebinding using the individual's username & password. How should I proceed?






    Cody Skidmore

    Friday, April 28, 2017 2:58 PM

Answers

  • Thanks Wendy but NetIQ told me to ask the question here. I kept getting ping-ponged around Internet forums.

    In any case I found the answer on my own.


    Cody Skidmore

    Wednesday, May 3, 2017 6:16 PM

All replies

  • Hi Cody Skidmore1,

    Thank you for posting here.

    For your question is more related to NetIQ eDirectory, you could get support here.

    The Visual C# discuss and ask the C# programming language, IDE, libraries, samples and tools.

    If you have some grammar or code errors, please feel free to contact us. We will try our best to give you a solution.

    Thanks for your understanding and cooperation.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, May 3, 2017 7:51 AM
    Moderator
  • Thanks Wendy but NetIQ told me to ask the question here. I kept getting ping-ponged around Internet forums.

    In any case I found the answer on my own.


    Cody Skidmore

    Wednesday, May 3, 2017 6:16 PM