【问题标题】:How to use secure flag when AuthenticationTypes.Sealing is used使用 AuthenticationTypes.Sealing 时如何使用安全标志
【发布时间】:2020-09-15 09:12:06
【问题描述】:

我正在使用创建目录条目对象

System.DirectoryServices.DirectoryEntry dirEntry = new System.DirectoryServices.DirectoryEntry(path,
                    null, null, System.DirectoryServices.AuthenticationTypes.Sealing))

它给了我警告:The Secure flag must also be set to use sealing. 我需要做什么 ?我可以通过使用来抑制上述警告

#pragma warning disable S4433 // LDAP connections should be authenticated

你能解释一下我错过了什么吗? 请注意,我使用 AuthenticationTypes.Sealing 是因为我想从性能角度在一次提交中创建和设置 AD 中的用户密码。

请解释一下。

【问题讨论】:

    标签: c# authentication active-directory directoryentry


    【解决方案1】:

    AuthenticationTypes 枚举是位标志,意味着可以组合多个值。错误是说你不能在没有Secure 的情况下使用Sealing。所以你必须同时包含这两者,你可以使用|,像这样:

    DirectoryEntry dirEntry = new DirectoryEntry(path,
        null, null, AuthenticationTypes.Sealing | AuthenticationTypes.Secure);
    

    【讨论】:

      猜你喜欢
      • 2016-09-11
      • 2020-04-28
      • 2018-02-03
      • 2015-06-07
      • 2020-10-15
      • 1970-01-01
      • 2012-11-23
      • 2015-03-05
      • 2016-02-10
      相关资源
      最近更新 更多