It's all about the answers!

Ask a question

What has changed in form authentication between JTS release 4 and 5?


Ian Giblett (2621416) | asked Nov 19 '14, 11:56 a.m.
 I had a little C# application would could login to DNG on Jazz release 4 and with it I could retrieve the requirements using OSLC.

However, when we upgraded to JTS release 5 I now get "The remote server returned an error: 401 Unauthorised."

I'm using the Webclient class to take of the cookies and header.
Now, this code executes with out error. The unauthorised error only occurs when I try to retrieve the catalog of projects. Can anyone tell me if this is the correct way or if I am missing something. Like I said, my application used to work fine
     class WebClientEx : WebClient 
    {
        private CookieContainer _cookieContainer = new CookieContainer();

        protected override WebRequest GetWebRequest(Uri address)
        {
            WebRequest request = base.GetWebRequest(address);
            if (request is HttpWebRequest)
            {
                (request as HttpWebRequest).CookieContainer  = _cookieContainer;
                (request as HttpWebRequest).Accept = "application/rdf+xml";               
            }  
            request.Headers.Add("OSLC-Core-Version: 2.0");      
            return request;
        }        
   }
And here I try to login
	
     public void JazzFormLogin()
        {
            private WebClientEx client = new WebClientEx();
         
            String webContextUrl = "http://MyServer.org.uk/jts/j_security_check";
            String user = txtUser.Text;
            String passwd = txtPassword.Text;
           
          var response1 = client.DownloadString("http://MyServer.org.uk/jts/authenticated/identity");

            var data = new NameValueCollection 
            {
                {"j_username",user},
                {"j_password",passwd},
            };
            var response2 = client.UploadValues(webContextUrl, data);
        }


Any advice welcome!
Thanks,

Ian


Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.