active-directory – 使用委派模拟或在Kerberos上多跳一次?完全迷失了

我的问题是如何处理安全性和正确实现模拟,这些模拟将从客户端计算机上运行并正确验证我的IIS服务器,该服务器传递仍然有效的模拟票证以及LDAP请求.

我的系统是在我的公司内部网上运行的独立服务器,它托管域控制器,LDAP服务器等,并使用Kerberos协议.

>系统信息:在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.但是,您需要确保允许托管上述代码的服务帐户(或网络服务的计算机帐户)委派给您环境中所有DC上的LDAP服务.

相关文章

Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...
Windows文件操作基础代码 Windows下对文件进行操作使用的一段...
Winpcap基础代码 使用Winpcap进行网络数据的截获和发送都需要...
使用vbs脚本进行批量编码转换 最近需要使用SourceInsight查看...