[Mono-bugs] [Bug 73681][Nor] Changed - Problem with HTTPWebRequest Basic authentication and POST
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 17 Mar 2005 07:03:31 -0500 (EST)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by informatique.internet@fiducial.fr.
http://bugzilla.ximian.com/show_bug.cgi?id=73681
--- shadow/73681 2005-03-17 04:54:04.000000000 -0500
+++ shadow/73681.tmp.22415 2005-03-17 07:03:31.000000000 -0500
@@ -296,6 +296,60 @@
</TD></TR></TABLE></BODY></HTML>
------- Additional Comments From informatique.internet@fiducial.fr 2005-03-17 04:54 -------
It seems that mono ignore the authentication request and send the xml
soap request even if he isn't authorized...
+
+------- Additional Comments From informatique.internet@fiducial.fr 2005-03-17 07:03 -------
+I've done some tests this morning by adding some Console.Writeline to
+basicclient.cs :
+static Authorization InternalAuthenticate (WebRequest webRequest,
+ICredentials credentials)
+ {
+ // Fongarnand
+ HttpWebRequest request = webRequest as HttpWebRequest;
+ Console.WriteLine("WebRequest Method:"+request.Method);
+ if (credentials==null)
+ Console.WriteLine("No Credentials");
+ else
+ Console.WriteLine("Credentials exists...");
+ Console.WriteLine("Credentials :"+credentials.ToString());
+ if (request == null || credentials == null)
+ return null;
+
+ NetworkCredential cred = credentials.GetCredential
+(request.AuthUri, "basic");
+ if (cred==null)
+ {
+ Console.WriteLine("NetworkCredential null");
+ }
+ string userName = cred.UserName;
+ if (userName == null || userName == "")
+ return null;
+
+ string password = cred.Password;
+ string domain = cred.Domain;
+ byte [] bytes;
+
+ // If domain is set, MS sends "domain\user:password".
+ if (domain == null || domain == "" || domain.Trim () == "")
+ bytes = Encoding.Default.GetBytes (userName + ":" + password);
+ else
+ bytes = Encoding.Default.GetBytes (domain + "\\" + userName + ":"
++ password);
+
+ string auth = "Basic " + Convert.ToBase64String (bytes);
+ return new Authorization (auth);
+ }
+
+I obtain :
+WebRequest Method:POST
+Credentials exists...
+Credentials :System.Net.CredentialCache
+NetworkCredential null
+
+So i can say that the problem comes from the getcredential method...
+because it returns null...
+
+
+