"프록시 사용자"를 사용하여 LDAP 서버 (Active Directory, Novell 또는 기타)에 연결 한 다음 응용 프로그램에 로그인하려는 사용자가 입력했는지 확인하려고합니다 허용되는 사용자 이름과 암호로 나는 LDAP에 연결하는 코드를 얻었지만 사용자 이름과 암호를 확인하는 방법은별로 없다. LDAP 쿼리를 통해이 작업을 수행 할 수 있습니까?프록시 사용자를 사용하여 .NET에서 LDAP 인증
여기에 지금까지 내 코드의 배짱이다 : 나는 과거에 사용했던
Public Function Authenticate(ByVal UserName As String, ByVal Password As String)
Dim LDAPServer As String = ConfigurationManager.AppSettings("LDAPServer")
Dim proxyUsername As String = ConfigurationManager.AppSettings("LDAPProxyUser")
Dim proxyPassword As String = ConfigurationManager.AppSettings("LDAPProxyPassword")
Dim entry As DirectoryEntry
entry = New DirectoryEntry(LDAPServer, proxyUsername, proxyPassword)
'This performs the LDAP authentication'
Dim obj As Object = entry.NativeObject
Dim search As New DirectorySearcher(entry)
search.Filter = String.Format("(SAMAccountName={0})", UserName)
'How do I check the password now?'
Dim result As SearchResult = search.FindOne()
If result Is Nothing Then Throw New Exception("Unable to find SAMAccountName")