Client is a .NET web application hosted on Windows 2008 server trying to access WebHDFS service on Hadoop server (Unix) that is secured using Kerberos security.
.Net client code that used to work before Hadoop server was secured using Kerberos was:
-----------------Code----------------
requestUri = “http://<Unix Hadoop Server>:50070/webhdfs/v1/prod/****/****?op=LISTSTATUS”
HttpWebRequest http = (HttpWebRequest)WebRequest.Create(requestUri);
http.Timeout = timeout;
http.ContentType = contentType;
string responseData = string.Empty;
using (WebResponse response = http.GetResponse())
{
Stream stream = response.GetResponseStream();
StreamReader sr = new StreamReader(stream);
responseData = sr.ReadToEnd();
}
return responseData;
---------------Code End--------------
Also, earlier I used to access above WebHDFS url using browser, it would return data in JSON format as expected. However, after implementation of security it returns following error message:
---------------------Error------------------
HTTP ERROR 403
Problem accessing /webhdfs/v1/prod/****/****. Reason:
GSSException: Defective token detected (Mechanism level: GSSHeader did not find the right tag)
-------------------Error End----------------
Found few samples using kinit in Java, but I am trying to figure out a way to do it in .NET code.
Any sample code or guidance to right direction will be appreciated!