我目前正在尝试使用IIS / 6.0数据服务器进行身份验证。使用下面的代码,如何从服务器检索质询。目前我正在做的是将第一个GET请求发送到服务器
//Part 1: The Request
pw.println("GET /dashboard/ HTTP/1.1");
pw.println("Host: MyServer.net");
pw.println("User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0");
pw.println("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
pw.println("Accept-Language: en-US,en;q=0.5");
pw.println("Accept-Encoding: gzip, deflate");
pw.println("Connection: keep-alive");
pw.println("WWW-Authenticate: Negotiate");
pw.println();
pw.flush();
//Part 1: The Response
HTTP/1.1 401 Unauthorized
Content-Length: 1656
Content-Type: text/html
Server: Microsoft-IIS/6.0
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
Date: Mon, 14 Sep 2015 19:28:16 GMT
然后我发送下一个请求
//Part 2: The Request
pw.println("GET /dashboard/ HTTP/1.1");
pw.println("Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
pw.println("Referer: http://MyServer.net/dashboard/");
pw.println("Accept-Language: en-US,en;q=0.5");
pw.println("User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0");
pw.println("Accept-Encoding: gzip, deflate");
pw.println("Host: MyServer.net");
pw.println("Connection: keep-alive");
pw.println("Authorization: Negotiate");
pw.println();
pw.flush();
//Part 2: The Response
HTTP/1.1 401 Unauthorized
Content-Length: 1539
Content-Type: text/html
Server: Microsoft-IIS/6.0
WWW-Authenticate: Negotiate YF0GBisGAQUFAqBTMFGgMDAuBgkqhkiC9xIBAgIGCSqGSIb3EgECAgYKKoZIhvcSAQICAwYKKwYBBAGCNwICCqMdMBugGRsXcGFlbXMxOTYkQFNUQVJCVUNLUy5ORVQ=
X-Powered-By: ASP.NET
Date: Mon, 14 Sep 2015 19:28:16 GMT
我认为我在这里做错了两件事。
目前我找到了一个非常有用的文档Responding to the Challenge,它有助于解释如何编码Active Directory凭据
我需要采取哪些步骤才能对服务器进行完全身份验证,以便我可以从中轮询数据?