开发者

How to use WinHTTP library for kerberos (windows integrated) authentication

开发者 https://www.devze.com 2023-01-30 16:38 出处:网络
There is a server running on linux box which understand kerberos, which also process SPNEGO and understands only kerberos but it does not understand NTLM

There is a server running on linux box which understand kerberos, which also process SPNEGO and understands only kerberos but it does not understand NTLM

The firefox and IE logins and access the web page succesfully using kerberos tokens without prompting again for the password.

Now, I am trying to write a application using WinHTTP library. I followed the example from here http://msdn.microsoft.com/en-开发者_如何学JAVAUs/library/aa383144(v=vs.85).aspx

In the WinHttpSetCredentials call, i do not want to set the username password instead i want to tell this call to use existing credential. How do I do that?

If i mention blank for username and password it does not work, it falls back to NTLM and fails.

So can someone tell me how to use WinHTTPSetCredentials?


In fact you need to set the HTTP_OPTION_AUTOLOGON_POLICY to allow auto-logons to work (see WinHttpSetOption). With this the WinHTTP library will handle the 401 refusal accompanied by a WWW-Authenticate: Negotiate and subsequent Kerberos based retry automagically.


You have to set AuthScheme parameter to WINHTTP_AUTH_SCHEME_NEGOTIATE

0

精彩评论

暂无评论...
验证码 换一张
取 消