How to use WinHTTP library for authentication using keberos (Windows)

There is a linux box-based server that understands keberos that also process SPNEGO and only kerberos understand, but it does not understand NTLM

Firefox and IE register and gain access to the web page successfully using kerberos tokens without asking for a password for the password.

Now I am trying to write an application using the WinHTTP library. I followed the example from here http://msdn.microsoft.com/en-Us/library/aa383144(v=vs.85).aspx

In a call to WinHttpSetCredentials, I don’t want to specify a user password, instead I want this call to use existing credentials. How to do it?

If I mention an empty username and password, it does not work, it returns to NTLM and fails.

So can someone tell me how to use WinHTTPSetCredentials?

+4
source share
2 answers

In fact, you need to set HTTP_OPTION_AUTOLOGON_POLICY to enable auto-login (see WinHttpSetOption). In this case, the WinHTTP library will handle a 401 failure, followed by a retry of WWW-Authenticate: Negotiate and a subsequent retry of Kerberos.

+1
source

You must set the AuthScheme parameter to WINHTTP_AUTH_SCHEME_NEGOTIATE

0
source

Source: https://habr.com/ru/post/1332323/


All Articles