Author: igorz
Date: 2008-02-17 09:14:52 -0500 (Sun, 17 Feb 2008)
New Revision: 95970

Added:
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/EncodingConverter.cs
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/SecurityAlgorithmSuiteConverter.cs
Modified:
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpMessageSecurityElement.cs
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/ChangeLog
   trunk/olive/class/System.ServiceModel/System.ServiceModel.dll.sources
Log:
2008-02-17  Igor Zelmanovich <[EMAIL PROTECTED]>

        * EncodingConverter.cs: added internal class.
        * SecurityAlgorithmSuiteConverter.cs: added internal class.
        * BasicHttpMessageSecurityElement.cs: 
        use SecurityAlgorithmSuiteConverter for "algorithmSuite" property.
        


Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpMessageSecurityElement.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpMessageSecurityElement.cs
  2008-02-17 14:07:10 UTC (rev 95969)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/BasicHttpMessageSecurityElement.cs
  2008-02-17 14:14:52 UTC (rev 95970)
@@ -67,7 +67,7 @@
                {
                        properties = new ConfigurationPropertyCollection ();
                        algorithm_suite = new ConfigurationProperty 
("algorithmSuite",
-                               typeof (SecurityAlgorithmSuite), "Default", 
null/* FIXME: get converter for SecurityAlgorithmSuite*/, null,
+                               typeof (SecurityAlgorithmSuite), "Default", new 
 SecurityAlgorithmSuiteConverter(), null,
                                ConfigurationPropertyOptions.None);
 
                        client_credential_type = new ConfigurationProperty 
("clientCredentialType",

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/ChangeLog
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/ChangeLog
   2008-02-17 14:07:10 UTC (rev 95969)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/ChangeLog
   2008-02-17 14:14:52 UTC (rev 95970)
@@ -1,3 +1,10 @@
+2008-02-17  Igor Zelmanovich <[EMAIL PROTECTED]>
+
+       * EncodingConverter.cs: added internal class.
+       * SecurityAlgorithmSuiteConverter.cs: added internal class.
+       * BasicHttpMessageSecurityElement.cs: 
+       use SecurityAlgorithmSuiteConverter for "algorithmSuite" property.
+       
 2008-02-16  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * MethodStubs.cs : Added CreateBehavior() method in couple of elements.

Added: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/EncodingConverter.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/EncodingConverter.cs
        2008-02-17 14:07:10 UTC (rev 95969)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/EncodingConverter.cs
        2008-02-17 14:14:52 UTC (rev 95970)
@@ -0,0 +1,85 @@
+//
+// EncodingConverter.cs
+//
+// Author:
+//     Igor Zelmanovich <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2008 Mainsoft, Inc.  http://www.mainsoft.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.ComponentModel;
+using System.Globalization;
+
+namespace System.ServiceModel.Configuration
+{
+       sealed class EncodingConverter : TypeConverter
+       {
+               static EncodingConverter _instance = new EncodingConverter ();
+
+               public static EncodingConverter Instance {
+                       get { return _instance; }
+               }
+
+               public override bool CanConvertFrom (ITypeDescriptorContext 
context, Type sourceType) {
+                       return sourceType == typeof (string);
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext 
context, CultureInfo culture, object value) {
+                       string encString = (string) value;
+                       Encoding encoding;
+
+                       switch (encString.ToLower 
(CultureInfo.InvariantCulture)) {
+                       case "utf-16le":
+                       case "utf-16":
+                       case "ucs-2":
+                       case "unicode":
+                       case "iso-10646-ucs-2":
+                               encoding = new UnicodeEncoding (false, true);
+                               break;
+                       case "utf-16be":
+                       case "unicodefffe":
+                               encoding = new UnicodeEncoding (true, true);
+                               break;
+                       case "utf-8":
+                       case "unicode-1-1-utf-8":
+                       case "unicode-2-0-utf-8":
+                       case "x-unicode-1-1-utf-8":
+                       case "x-unicode-2-0-utf-8":
+                               encoding = Encoding.UTF8;
+                               break;
+                       default:
+                               encoding = Encoding.GetEncoding (encString);
+                               break;
+                       }
+
+                       return encoding;
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext 
context, CultureInfo culture, object value, Type destinationType) {
+                       Encoding encoding = (Encoding) value;
+                       return encoding.WebName;
+               }
+       }
+}

Added: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/SecurityAlgorithmSuiteConverter.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/SecurityAlgorithmSuiteConverter.cs
  2008-02-17 14:07:10 UTC (rev 95969)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Configuration/SecurityAlgorithmSuiteConverter.cs
  2008-02-17 14:14:52 UTC (rev 95970)
@@ -0,0 +1,81 @@
+//
+// SecurityAlgorithmSuiteConverter.cs
+//
+// Author:
+//     Igor Zelmanovich <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2008 Mainsoft, Inc.  http://www.mainsoft.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.ComponentModel;
+using System.ServiceModel.Security;
+
+namespace System.ServiceModel.Configuration
+{
+       sealed class SecurityAlgorithmSuiteConverter : TypeConverter
+       {
+               public override bool CanConvertFrom (ITypeDescriptorContext 
context, Type sourceType) {
+                       return sourceType == typeof (string);
+               }
+
+               public override object ConvertFrom (ITypeDescriptorContext 
context, System.Globalization.CultureInfo culture, object value) {
+                       string strValue = (string) value;
+                       switch (strValue.ToLowerInvariant ()) {
+                       case "default":
+                               return SecurityAlgorithmSuite.Default;
+                       case "basic128":
+                               return SecurityAlgorithmSuite.Basic128;
+                       case "basic128rsa15":
+                               return SecurityAlgorithmSuite.Basic128Rsa15;
+                       case "basic128sha256":
+                               return SecurityAlgorithmSuite.Basic128Sha256;
+                       case "basic128sha256rsa15":
+                               return 
SecurityAlgorithmSuite.Basic128Sha256Rsa15;
+                       case "basic192":
+                               return SecurityAlgorithmSuite.Basic192;
+                       case "basic192rsa15":
+                               return SecurityAlgorithmSuite.Basic192Rsa15;
+                       case "basic192sha256":
+                               return SecurityAlgorithmSuite.Basic192Sha256;
+                       case "basic192sha256rsa15":
+                               return 
SecurityAlgorithmSuite.Basic192Sha256Rsa15;
+                       case "basic256":
+                               return SecurityAlgorithmSuite.Basic256;
+                       case "basic256rsa15":
+                               return SecurityAlgorithmSuite.Basic256Rsa15;
+                       case "basic256sha256":
+                               return SecurityAlgorithmSuite.Basic256Sha256;
+                       case "basic256sha256rsa15":
+                               return 
SecurityAlgorithmSuite.Basic256Sha256Rsa15;
+                       }
+                       throw new ArgumentException ();
+               }
+
+               public override object ConvertTo (ITypeDescriptorContext 
context, System.Globalization.CultureInfo culture, object value, Type 
destinationType) {
+                       return base.ConvertTo (context, culture, value, 
destinationType);
+               }
+
+       }
+}

Modified: trunk/olive/class/System.ServiceModel/System.ServiceModel.dll.sources
===================================================================
--- trunk/olive/class/System.ServiceModel/System.ServiceModel.dll.sources       
2008-02-17 14:07:10 UTC (rev 95969)
+++ trunk/olive/class/System.ServiceModel/System.ServiceModel.dll.sources       
2008-02-17 14:14:52 UTC (rev 95970)
@@ -340,6 +340,7 @@
 System.ServiceModel.Configuration/DataContractSerializerElement.cs
 System.ServiceModel.Configuration/DiagnosticSection.cs
 System.ServiceModel.Configuration/DnsElement.cs
+System.ServiceModel.Configuration/EncodingConverter.cs
 System.ServiceModel.Configuration/EndpointAddressElementBase.cs
 System.ServiceModel.Configuration/EndpointBehaviorElement.cs
 System.ServiceModel.Configuration/EndpointBehaviorElementCollection.cs
@@ -418,6 +419,7 @@
 System.ServiceModel.Configuration/ReliableSessionElement.cs
 System.ServiceModel.Configuration/RsaElement.cs
 System.ServiceModel.Configuration/SecureConversationServiceElement.cs
+System.ServiceModel.Configuration/SecurityAlgorithmSuiteConverter.cs
 System.ServiceModel.Configuration/SecurityElement.cs
 System.ServiceModel.Configuration/SecurityElementBase.cs
 System.ServiceModel.Configuration/ServiceAuthorizationElement.cs

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to