1

For some reason, I cannot authenticate user credentials using LDS for users created in LDS.

My test code is:

        PrincipalContext context = new PrincipalContext(ContextType.ApplicationDirectory, "adlds:50000", "CN=test,DC=test,DC=internal", ContextOptions.Negotiate);

        UserPrincipal user = new UserPrincipal(context);

        user.Enabled = true;
        user.Name = "MyTestUser";
        user.SetPassword("P@ssw0rd1");
        user.GivenName = "ATestUser123";
        user.Surname = "SurnameOf";

        user.Save();

        bool auth = context.ValidateCredentials("MyTestUser", "P@ssw0rd1");

ValidateCredentials is returning false each time.

LDS is running on Server 2008 R2 that is domain joined. I have tried recreating the context, expiring passwords, manually reseting passwords through ADSI, etc.

Any thoughts?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Steve
  • 4,463
  • 1
  • 19
  • 24

1 Answers1

4

I've come along the same problem. What I did, and works for me, is when calling ValidateCredentials I modified the username a bit:

bool auth = context.ValidateCredentials(
                            String.Format("CN={0},CN=test,DC=test,DC=internal",
                                          "MyTestUser"), 
                            "P@ssw0rd1");

Hope this helps.

Szymon Seliga
  • 784
  • 5
  • 23