Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstukselbax <stukselbax@gmail.com>2015-10-26 13:29:35 +0300
committerstukselbax <stukselbax@gmail.com>2015-10-26 13:29:35 +0300
commitfccd4b01a7dac5a8e7abab5cf2fa55e4f042be13 (patch)
tree07851d5158b9f329bb631b2b917423154bded465 /mcs/class/System.ServiceModel.Web
parent9f333557cc4d50bd25a423ceb835680b55f416c0 (diff)
Make "https" scheme only when Transport security mode is ON
The behavior of the WebHttpBinding in case of SecurityMode == WebHttpSecurityMode.TransportCredentialOnly must use the http scheme, in order to allow authentication of the client based on the standard HTTP headers, like WWW-Authenticate: Scheme realm="" and so on. This behavior is the default in .net;
Diffstat (limited to 'mcs/class/System.ServiceModel.Web')
-rw-r--r--mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs2
-rw-r--r--mcs/class/System.ServiceModel.Web/Test/System.ServiceModel/WebHttpBindingTest.cs10
2 files changed, 11 insertions, 1 deletions
diff --git a/mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs b/mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs
index fc8a065f5ae..8eee88bb876 100644
--- a/mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs
+++ b/mcs/class/System.ServiceModel.Web/System.ServiceModel/WebHttpBinding.cs
@@ -158,7 +158,7 @@ namespace System.ServiceModel
}
public override string Scheme {
- get { return Security.Mode != WebHttpSecurityMode.None ? Uri.UriSchemeHttps : Uri.UriSchemeHttp; }
+ get { return Security.Mode == WebHttpSecurityMode.Transport ? Uri.UriSchemeHttps : Uri.UriSchemeHttp; }
}
public WebHttpSecurity Security {
diff --git a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel/WebHttpBindingTest.cs b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel/WebHttpBindingTest.cs
index 1c0c0077ce8..b4a016a26f4 100644
--- a/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel/WebHttpBindingTest.cs
+++ b/mcs/class/System.ServiceModel.Web/Test/System.ServiceModel/WebHttpBindingTest.cs
@@ -32,5 +32,15 @@ namespace MonoTests.System.ServiceModel
Assert.AreEqual (typeof (WebMessageEncodingBindingElement), bc [0].GetType (), "#2");
Assert.AreEqual (typeof (HttpTransportBindingElement), bc [1].GetType (), "#3");
}
+
+ [Test]
+ public void DefaultSchemeBasedOnSecurityMode ()
+ {
+ WebHttpBinding b = new WebHttpBinding(WebHttpSecurityMode.TransportCredentialOnly);
+ Assert.AreEqual("http", b.Scheme, "#1");
+
+ b = new WebHttpBinding(WebHttpSecurityMode.Transport);
+ Assert.AreEqual("https", b.Scheme, "#2");
+ }
}
}