【问题标题】:AD Lightweight Directory Services not Authenticating UsersAD 轻量级目录服务未对用户进行身份验证
【发布时间】:2010-09-07 19:49:38
【问题描述】:

由于某种原因,我无法使用 LDS 为在 LDS 中创建的用户验证用户凭据。

我的测试代码是:

        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 每次都返回 false。

LDS 在已加入域的 Server 2008 R2 上运行。我尝试过重新创建上下文、过期密码、通过 ADSI 手动重置密码等。

有什么想法吗?

【问题讨论】:

    标签: authentication active-directory


    【解决方案1】:

    我也遇到了同样的问题。我所做的并且对我有用的是,在调用 ValidateCredentials 时,我稍微修改了用户名:

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

    希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-26
      • 1970-01-01
      • 2017-12-11
      • 1970-01-01
      相关资源
      最近更新 更多