active-directory - 在 Kerberos 上模拟委托(delegate)或不止一跳?完全迷失

标签 active-directory windows-authentication impersonation kerberos delegation

我在这里的问题是如何处理安全性和模拟的正确实现,这将在客户端计算机上工作并正确地向我的 IIS 服务器进行身份验证,该服务器将仍然有效的模拟票证与 LDAP 请求一起传递。

我的系统是运行在我公司内部网上的独立服务器,它托管域 Controller 、LDAP 服务器等,并使用 Kerberos 协议(protocol)。

  • 系统信息:在 Windows 7 x64 上使用 Windows Auth 和 Impersonate 的 IIS7
  • 网络信息:IIS 6、LDAP、Kerberos

  • 这是我的 VB.NET 方法。

    Protected FirstName, LastName, EMail As String
    Protected Sub Lookup(ByVal UserName As String)
        UserName = Trim(UserName)
        UserName = Replace(UserName, "\", "/")
        UserName = Right(UserName, Len(UserName) - InStr(1, UserName, "/"))
    
        Using (Hosting.HostingEnvironment.Impersonate) 'ADDED
            Dim directoryEntry As New DirectoryEntry("LDAP://dl/DC=dl,DC=net")
            'directoryEntry.AuthenticationType = AuthenticationTypes.Delegation 'REMOVED
    
            Dim ds As New DirectorySearcher(directoryEntry)
            Dim r As SearchResult
            Try
                ds.PropertiesToLoad.Add("givenName") 'First Name
                ds.PropertiesToLoad.Add("sn")        'Last Name
                ds.PropertiesToLoad.Add("mail")      'Email
    
                ds.Filter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=" & UserName & "))"
                r = ds.FindOne 'Query LDAP; find record with UserName.
    
                'Populates all the variables retrieved from LDAP.
                FirstName = If(r.Properties.Contains("givenName"), Trim(r.Properties("givenName").Item(0)), "")
                LastName = If(r.Properties.Contains("sn"), Trim(r.Properties("sn").Item(0)), "")
                If IsNothing(r.Properties.Contains("mail")) Then
                    EMail = If(r.Properties.Contains("userPrincipalName"), Trim(r.Properties("userPrincipalName").Item(0)), "")
                Else
                    EMail = If(r.Properties.Contains("mail"), Trim(r.Properties("mail").Item(0)), "")
                End If
                EMail = EMail.ToLower
            Catch ex As Exception
                'Error Logging to Database Here
            End Try
        End Using
    End Sub
    

    请提出任何必要的问题,以获得帮助我所需的信息。我已经研究了好几个星期了,看起来模仿有如此多的变量,我很容易迷失方向。我只是不知道如何在我的代码中实现这一点......我对.NET还是很陌生:(

    最佳答案

    您不需要配置 AuthenticationType为此工作。但是,您需要确保允许托管上述代码的服务帐户(或计算机帐户,如果是网络服务)委托(delegate)给您环境中所有 DC 上的 LDAP 服务。

    关于active-directory - 在 Kerberos 上模拟委托(delegate)或不止一跳?完全迷失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9232482/

    相关文章:

    c# - 将文件复制到我无权访问的网络共享

    azure - 如何将任何 Azure Active Directory (AD) 用户登录到连接到 Office 365 Sharepoint Online API 的共享 native 应用程序

    c# - 在 MVC3 中未授权页面时重定向用户

    php - 如何使用 PHP 取消对 Windows Auth 用户的身份验证

    javascript - 带有 NODESSPI 的企业环境中的 Node

    c# - 无法在 DLL 'LogonUser' 模拟异常中找到名为 'advapi32.dll' 的入口点

    asp.net - 从 ASP 启动/停止服务。网页

    arrays - 在 Powershell 中比较数组

    iphone - 如何在 swift 中验证 iOS 应用程序

    angular cli + windows 身份验证后端