0

Is there a way to detect the AD credentials of a user and use them to create a NetworkCredential object that can be used to query a webservice? An excerpt of my code is below, basically I'm querying a GIS database through a webservice and the webservice requires Windows AD authentication.

Currently this is a manual process and so we just hardcode our own AD credentials into the variables up top and it works fine but I'd like the page the detect someone's AD credentials and use them to create the NetworkCredential object so we can have our internal customers use the page as well.

Public Function getJSON(ByVal url As String) As String

    Dim HTMLSource As String = ""
    Dim Request As WebRequest = WebRequest.Create(url)
    Request.Credentials = New NetworkCredential(username, password, domain)
    Dim Response As WebResponse = Request.GetResponse
    Dim SR As StreamReader
    SR = New StreamReader(Response.GetResponseStream)
    HTMLSource = SR.ReadToEnd
    SR.Close()
    Return HTMLSource
End Function
4

1 に答える 1

0

ユーザーが自分の Kerberos 資格情報をサーバー/サービスに委任し、認証中にそれを抽出し、偽装して、ユーザーに代わって要求を実行できるようにします。

于 2012-12-15T21:44:30.277 に答える