0

I'm using IIS server as the KDC and have configured it to provide kerberos authentication. I have a sample c# client as below.

 public static void Main(string[] args)
    {
        AuthenticationManager.Unregister("Basic");
        AuthenticationManager.Unregister("NTLM");
        AuthenticationManager.Unregister("Digest");
        loadURL("http://localhost");
        Console.ReadLine();
    }

 private static void loadURL(String url)
    {
        try
        {
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
            req.Credentials = CredentialCache.DefaultCredentials;
            req.Proxy = null;
            HttpWebResponse result = (HttpWebResponse)req.GetResponse();
            Console.WriteLine("Authentication Succeeded:");
            Stream stream = result.GetResponseStream();
            showContent(stream);
        }
        catch (WebException e)
        {
            if (e.Status == WebExceptionStatus.ProtocolError)
            {
                HttpWebResponse hresp = (HttpWebResponse)e.Response;
                Console.WriteLine("\nAuthentication Failed, " + hresp.StatusCode);
                Console.WriteLine("Status Code: " + (int)hresp.StatusCode);
                Console.WriteLine("Status Description: " + hresp.StatusDescription);
                return;
            }
            Console.WriteLine("Caught Exception: " + e.Message);
            Console.WriteLine("Stack: " + e.StackTrace);
        }
    }

According to the concept of kerberos what should happen is : 1. Client request a ticket from KDC 2. KDC responds with the ticket after authentication 3. Client uses this ticket and send a request to resource server 4. Resource server sends a response.

But by using above code I did not need to obtain a TGT. I sent my credentials with the resource url and I got the requested results. If I turn off the kerberos in Windows authentication this I got 401 so I have a proof that this is authenticated by kerberos. What did I miss here?

Hasanthi
  • 1,251
  • 3
  • 14
  • 30
  • Kerberos is not performed on localhost by SSPI due to a short-circuit which can be disabled via registry. – Michael-O Jun 14 '16 at 17:29
  • Michael, Can you please have a look at to the question http://stackoverflow.com/questions/37958942/the-specified-principle-is-not-known-in-the-authentication-system – Hasanthi Jun 22 '16 at 05:06

0 Answers0