qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ai...@apache.org
Subject svn commit: r886998 [12/14] - in /qpid/trunk: ./ qpid/dotnet/Qpid.Buffer.Tests/ qpid/dotnet/Qpid.Buffer.Tests/Properties/ qpid/dotnet/Qpid.Buffer/ qpid/dotnet/Qpid.Client.Tests/BrokerDetails/ qpid/dotnet/Qpid.Client.Tests/Channel/ qpid/dotnet/Qpid.Clie...
Date Thu, 03 Dec 2009 23:55:56 GMT
Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl.Tests/TestClientFactory.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/Callbacks.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/Callbacks.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/Callbacks.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/Callbacks.cs Thu Dec  3 23:55:48 2009
@@ -1,139 +1,139 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Text;
-using System.Globalization;
-using System.Security.Cryptography;
-
-namespace Apache.Qpid.Sasl
-{
-   /// <summary>
-   /// Marker interface for Sasl Callbacks
-   /// </summary>
-   public interface ISaslCallback
-   {
-   } // interface ISaslCallback
-
-   public abstract class TextSaslCallback : ISaslCallback
-   {
-      private string _prompt;
-      private string _text;
-      private string _defaultText;
-
-      public string Prompt
-      {
-         get { return _prompt; }
-         set { _prompt = value; }
-      }
-
-      public string Text
-      {
-         get {
-            if ( _text == null || _text.Length == 0 )
-               return DefaultText;
-            else
-               return _text;
-         }
-         set { _text = value; }
-      }
-
-      public string DefaultText
-      {
-         get { return _defaultText; }
-         set { _defaultText = value; }
-      }
-
-      protected TextSaslCallback(string prompt, string text, string defaultText)
-      {
-         _prompt = prompt;
-         _text = text;
-         _defaultText = defaultText;
-      }
-
-   } // class TextSaslCallback
-
-   public class NameCallback : TextSaslCallback
-   {
-      public NameCallback()
-         : this(Environment.UserName)
-      {
-      }
-      public NameCallback(string defaultText)
-         : base("username:", "", defaultText)
-      {
-      }
-   } // class NameCallback
-
-   public class PasswordCallback : TextSaslCallback
-   {
-      public PasswordCallback()
-         : base("password:", "", "")
-      {
-      }
-
-      public byte[] HashedText
-      {
-          get
-          {
-            string _text = this.Text;
-            System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
-            byte[] bs = x.ComputeHash(Encoding.UTF8.GetBytes(_text));
-            return bs;
-          }
-
-      }
-   } // class PasswordCallback
-
-   public class HashedPasswordCallback : TextSaslCallback
-   {
-       public HashedPasswordCallback()
-           : base("password:", "", "")
-       {
-       }
-
-       public byte[] HashedText
-       {
-        get {
-               string _text = this.Text;
-               System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
-               _text = _text.PadRight(16, '\0');
-               byte[] bs = x.ComputeHash(Encoding.UTF8.GetBytes(_text));
-               return bs;
-        }
-       }
-   } // class PasswordCallback
-
-   public class RealmCallback : TextSaslCallback
-   {
-      public RealmCallback()
-         : this("localhost")
-      {
-      }
-      public RealmCallback(string defaultText)
-         : base("realm:", "", defaultText)
-      {
-      }
-   } // class RealmCallback
-
-} // namespace Apache.Qpid.Sasl
-
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Text;
+using System.Globalization;
+using System.Security.Cryptography;
+
+namespace Apache.Qpid.Sasl
+{
+   /// <summary>
+   /// Marker interface for Sasl Callbacks
+   /// </summary>
+   public interface ISaslCallback
+   {
+   } // interface ISaslCallback
+
+   public abstract class TextSaslCallback : ISaslCallback
+   {
+      private string _prompt;
+      private string _text;
+      private string _defaultText;
+
+      public string Prompt
+      {
+         get { return _prompt; }
+         set { _prompt = value; }
+      }
+
+      public string Text
+      {
+         get {
+            if ( _text == null || _text.Length == 0 )
+               return DefaultText;
+            else
+               return _text;
+         }
+         set { _text = value; }
+      }
+
+      public string DefaultText
+      {
+         get { return _defaultText; }
+         set { _defaultText = value; }
+      }
+
+      protected TextSaslCallback(string prompt, string text, string defaultText)
+      {
+         _prompt = prompt;
+         _text = text;
+         _defaultText = defaultText;
+      }
+
+   } // class TextSaslCallback
+
+   public class NameCallback : TextSaslCallback
+   {
+      public NameCallback()
+         : this(Environment.UserName)
+      {
+      }
+      public NameCallback(string defaultText)
+         : base("username:", "", defaultText)
+      {
+      }
+   } // class NameCallback
+
+   public class PasswordCallback : TextSaslCallback
+   {
+      public PasswordCallback()
+         : base("password:", "", "")
+      {
+      }
+
+      public byte[] HashedText
+      {
+          get
+          {
+            string _text = this.Text;
+            System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
+            byte[] bs = x.ComputeHash(Encoding.UTF8.GetBytes(_text));
+            return bs;
+          }
+
+      }
+   } // class PasswordCallback
+
+   public class HashedPasswordCallback : TextSaslCallback
+   {
+       public HashedPasswordCallback()
+           : base("password:", "", "")
+       {
+       }
+
+       public byte[] HashedText
+       {
+        get {
+               string _text = this.Text;
+               System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
+               _text = _text.PadRight(16, '\0');
+               byte[] bs = x.ComputeHash(Encoding.UTF8.GetBytes(_text));
+               return bs;
+        }
+       }
+   } // class PasswordCallback
+
+   public class RealmCallback : TextSaslCallback
+   {
+      public RealmCallback()
+         : this("localhost")
+      {
+      }
+      public RealmCallback(string defaultText)
+         : base("realm:", "", defaultText)
+      {
+      }
+   } // class RealmCallback
+
+} // namespace Apache.Qpid.Sasl
+
+

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/Callbacks.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/Configuration/SaslConfiguration.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/Configuration/SaslConfiguration.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/Configuration/SaslConfiguration.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/Configuration/SaslConfiguration.cs Thu Dec  3 23:55:48 2009
@@ -1,90 +1,90 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Configuration;
-using System.Text;
-using System.Xml;
-
-namespace Apache.Qpid.Sasl.Configuration
-{
-   /// <summary>
-   /// Represents an Sasl configuration section
-   /// in the config file
-   /// </summary>
-   internal class SaslConfiguration
-   {
-      private IList _clientFactories;
-
-      /// <summary>
-      /// Set of configured client factores
-      /// </summary>
-      public IList ClientFactories
-      {
-         get { return _clientFactories; }
-      }
-
-      internal SaslConfiguration(IList clientFactoryTypes)
-      {
-         _clientFactories = new ArrayList();
-         foreach ( Type type in clientFactoryTypes )
-         {
-            _clientFactories.Add(Activator.CreateInstance(type));
-         }
-      }
-
-      /// <summary>
-      /// Get the configuration for the library
-      /// </summary>
-      /// <returns>The configuration from app.config or a default configuration</returns>
-      internal static SaslConfiguration GetConfiguration()
-      {
-         // 'obsolete' warning, but needed for .NET 1.1 compatibility
-         SaslConfiguration config = (SaslConfiguration)
-            ConfigurationSettings.GetConfig("qpid.sasl");
-         if ( config == null )
-         {
-            // create default configuration
-            IList clientFactories = GetDefaultClientFactories();
-            config = new SaslConfiguration(clientFactories);
-         }
-         return config;
-      }
-
-      /// <summary>
-      /// Create a list filled with the default client
-      /// factories supported by the library
-      /// </summary>
-      /// <returns>The list of client factory types</returns>
-      internal static IList GetDefaultClientFactories()
-      {
-         IList clientFactories = new ArrayList();
-         clientFactories.Add(typeof(DefaultClientFactory));
-         return clientFactories;
-      }
-
-
-   } // class SaslConfiguration
-
-} // namespace Apache.Qpid.Sasl.Configuration
-
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Text;
+using System.Xml;
+
+namespace Apache.Qpid.Sasl.Configuration
+{
+   /// <summary>
+   /// Represents an Sasl configuration section
+   /// in the config file
+   /// </summary>
+   internal class SaslConfiguration
+   {
+      private IList _clientFactories;
+
+      /// <summary>
+      /// Set of configured client factores
+      /// </summary>
+      public IList ClientFactories
+      {
+         get { return _clientFactories; }
+      }
+
+      internal SaslConfiguration(IList clientFactoryTypes)
+      {
+         _clientFactories = new ArrayList();
+         foreach ( Type type in clientFactoryTypes )
+         {
+            _clientFactories.Add(Activator.CreateInstance(type));
+         }
+      }
+
+      /// <summary>
+      /// Get the configuration for the library
+      /// </summary>
+      /// <returns>The configuration from app.config or a default configuration</returns>
+      internal static SaslConfiguration GetConfiguration()
+      {
+         // 'obsolete' warning, but needed for .NET 1.1 compatibility
+         SaslConfiguration config = (SaslConfiguration)
+            ConfigurationSettings.GetConfig("qpid.sasl");
+         if ( config == null )
+         {
+            // create default configuration
+            IList clientFactories = GetDefaultClientFactories();
+            config = new SaslConfiguration(clientFactories);
+         }
+         return config;
+      }
+
+      /// <summary>
+      /// Create a list filled with the default client
+      /// factories supported by the library
+      /// </summary>
+      /// <returns>The list of client factory types</returns>
+      internal static IList GetDefaultClientFactories()
+      {
+         IList clientFactories = new ArrayList();
+         clientFactories.Add(typeof(DefaultClientFactory));
+         return clientFactories;
+      }
+
+
+   } // class SaslConfiguration
+
+} // namespace Apache.Qpid.Sasl.Configuration
+
+

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/Configuration/SaslConfiguration.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/Configuration/SaslConfigurationSectionHandler.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/Configuration/SaslConfigurationSectionHandler.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/Configuration/SaslConfigurationSectionHandler.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/Configuration/SaslConfigurationSectionHandler.cs Thu Dec  3 23:55:48 2009
@@ -1,84 +1,84 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Configuration;
-using System.Text;
-using System.Xml;
-
-namespace Apache.Qpid.Sasl.Configuration
-{
-   /// <summary>
-   /// Defines the configuration section to configure extra 
-   /// Sasl client factories
-   /// </summary>
-   public class SaslConfigurationSectionHandler 
-      : IConfigurationSectionHandler
-   {
-      public object Create(object parent, object configContext, XmlNode section)
-      {
-         IList clientFactories = SaslConfiguration.GetDefaultClientFactories();
-
-         foreach ( XmlNode node in section.ChildNodes )
-         {
-            if ( node.LocalName == "clientFactories" )
-            {
-               ProcessFactories(node, clientFactories);
-            }
-         }
-
-         SaslConfiguration config = new SaslConfiguration(clientFactories);
-         return config;
-      }
-
-      
-      private void ProcessFactories(XmlNode node, IList factories)
-      {
-         foreach ( XmlNode child in node.ChildNodes )
-         {
-            Type type;
-            switch ( child.LocalName )
-            {
-            case "add":
-               type = Type.GetType(child.Attributes["type"].Value);
-               if ( !factories.Contains(type) )
-                  factories.Add(type);
-               break;
-            case "remove":
-               type = Type.GetType(child.Attributes["type"].Value);
-               if ( factories.Contains(type) )
-                  factories.Remove(type);
-               break;
-            case "clear":
-               factories.Clear();
-               break;
-            default:
-               // gives obsolete warning but needed for .NET 1.1 support
-               throw new ConfigurationException(string.Format("Unknown element '{0}' in section '{0}'", child.LocalName, node.LocalName));
-            }
-         }
-      }
-   } // class SaslConfigurationSectionHandler
-
-} // namespace Apache.Qpid.Sasl.Configuration
-
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Collections;
+using System.Configuration;
+using System.Text;
+using System.Xml;
+
+namespace Apache.Qpid.Sasl.Configuration
+{
+   /// <summary>
+   /// Defines the configuration section to configure extra 
+   /// Sasl client factories
+   /// </summary>
+   public class SaslConfigurationSectionHandler 
+      : IConfigurationSectionHandler
+   {
+      public object Create(object parent, object configContext, XmlNode section)
+      {
+         IList clientFactories = SaslConfiguration.GetDefaultClientFactories();
+
+         foreach ( XmlNode node in section.ChildNodes )
+         {
+            if ( node.LocalName == "clientFactories" )
+            {
+               ProcessFactories(node, clientFactories);
+            }
+         }
+
+         SaslConfiguration config = new SaslConfiguration(clientFactories);
+         return config;
+      }
+
+      
+      private void ProcessFactories(XmlNode node, IList factories)
+      {
+         foreach ( XmlNode child in node.ChildNodes )
+         {
+            Type type;
+            switch ( child.LocalName )
+            {
+            case "add":
+               type = Type.GetType(child.Attributes["type"].Value);
+               if ( !factories.Contains(type) )
+                  factories.Add(type);
+               break;
+            case "remove":
+               type = Type.GetType(child.Attributes["type"].Value);
+               if ( factories.Contains(type) )
+                  factories.Remove(type);
+               break;
+            case "clear":
+               factories.Clear();
+               break;
+            default:
+               // gives obsolete warning but needed for .NET 1.1 support
+               throw new ConfigurationException(string.Format("Unknown element '{0}' in section '{0}'", child.LocalName, node.LocalName));
+            }
+         }
+      }
+   } // class SaslConfigurationSectionHandler
+
+} // namespace Apache.Qpid.Sasl.Configuration
+
+

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/Configuration/SaslConfigurationSectionHandler.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/DefaultClientFactory.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/DefaultClientFactory.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/DefaultClientFactory.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/DefaultClientFactory.cs Thu Dec  3 23:55:48 2009
@@ -1,99 +1,99 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Collections;
-
-using Apache.Qpid.Sasl.Mechanisms;
-
-namespace Apache.Qpid.Sasl
-{
-   public class DefaultClientFactory : ISaslClientFactory
-   {
-      private static readonly string[] SUPPORTED = new string[] {
-               DigestSaslClient.Mechanism,
-               CramMD5SaslClient.Mechanism,
-               CramMD5HexSaslClient.Mechanism,
-               PlainSaslClient.Mechanism, 
-               AnonymousSaslClient.Mechanism,
-               ExternalSaslClient.Mechanism,
-            };
-
-      public string[] GetSupportedMechanisms(IDictionary props)
-      {
-         if ( props == null )
-            throw new ArgumentNullException("props");
-
-         ArrayList vetoed = new ArrayList();
-
-         if ( props.Contains(SaslProperties.PolicyNoPlainText) ||
-             props.Contains(SaslProperties.PolicyNoDictionary) ||
-             props.Contains(SaslProperties.PolicyNoActive) ||
-             props.Contains(SaslProperties.PolicyForwardSecrecy) ||
-             props.Contains(SaslProperties.PolicyPassCredentials) )
-         {
-            vetoed.Add(CramMD5SaslClient.Mechanism);
-            vetoed.Add(CramMD5HexSaslClient.Mechanism);
-            vetoed.Add(PlainSaslClient.Mechanism);
-            vetoed.Add(AnonymousSaslClient.Mechanism);
-            vetoed.Add(ExternalSaslClient.Mechanism);
-         } 
-         if ( props.Contains(SaslProperties.PolicyNoAnonymous) )
-         {
-            vetoed.Add(AnonymousSaslClient.Mechanism);
-         }
-
-         ArrayList available = new ArrayList();
-         foreach ( string mech in SUPPORTED )
-         {
-            if ( !vetoed.Contains(mech) )
-               available.Add(mech);
-         }
-         return (string[])available.ToArray(typeof(string));
-      }
-
-      public ISaslClient CreateClient(
-         string[] mechanisms, string authorizationId,
-         string protocol, string serverName, 
-         IDictionary props, ISaslCallbackHandler handler
-         )
-      {
-         IList mechs = mechanisms;
-         if ( mechs.Contains(ExternalSaslClient.Mechanism) )
-            return new ExternalSaslClient(authorizationId, props, handler);
-         if ( mechs.Contains(DigestSaslClient.Mechanism) )
-            return new DigestSaslClient(authorizationId, serverName, protocol, props, handler);
-         if ( mechs.Contains(CramMD5SaslClient.Mechanism) )
-            return new CramMD5SaslClient(authorizationId, props, handler);
-         if ( mechs.Contains(CramMD5HexSaslClient.Mechanism) )
-            return new CramMD5HexSaslClient(authorizationId, props, handler);
-         if ( mechs.Contains(PlainSaslClient.Mechanism) )
-            return new PlainSaslClient(authorizationId, props, handler);
-         if ( mechs.Contains(AnonymousSaslClient.Mechanism) )
-            return new AnonymousSaslClient(authorizationId, props, handler);
-         // unknown mechanism
-         return null;
-      }
-   } // class DefaultClientFactory
-
-} // namespace Apache.Qpid.Sasl
-
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Collections;
+
+using Apache.Qpid.Sasl.Mechanisms;
+
+namespace Apache.Qpid.Sasl
+{
+   public class DefaultClientFactory : ISaslClientFactory
+   {
+      private static readonly string[] SUPPORTED = new string[] {
+               DigestSaslClient.Mechanism,
+               CramMD5SaslClient.Mechanism,
+               CramMD5HexSaslClient.Mechanism,
+               PlainSaslClient.Mechanism, 
+               AnonymousSaslClient.Mechanism,
+               ExternalSaslClient.Mechanism,
+            };
+
+      public string[] GetSupportedMechanisms(IDictionary props)
+      {
+         if ( props == null )
+            throw new ArgumentNullException("props");
+
+         ArrayList vetoed = new ArrayList();
+
+         if ( props.Contains(SaslProperties.PolicyNoPlainText) ||
+             props.Contains(SaslProperties.PolicyNoDictionary) ||
+             props.Contains(SaslProperties.PolicyNoActive) ||
+             props.Contains(SaslProperties.PolicyForwardSecrecy) ||
+             props.Contains(SaslProperties.PolicyPassCredentials) )
+         {
+            vetoed.Add(CramMD5SaslClient.Mechanism);
+            vetoed.Add(CramMD5HexSaslClient.Mechanism);
+            vetoed.Add(PlainSaslClient.Mechanism);
+            vetoed.Add(AnonymousSaslClient.Mechanism);
+            vetoed.Add(ExternalSaslClient.Mechanism);
+         } 
+         if ( props.Contains(SaslProperties.PolicyNoAnonymous) )
+         {
+            vetoed.Add(AnonymousSaslClient.Mechanism);
+         }
+
+         ArrayList available = new ArrayList();
+         foreach ( string mech in SUPPORTED )
+         {
+            if ( !vetoed.Contains(mech) )
+               available.Add(mech);
+         }
+         return (string[])available.ToArray(typeof(string));
+      }
+
+      public ISaslClient CreateClient(
+         string[] mechanisms, string authorizationId,
+         string protocol, string serverName, 
+         IDictionary props, ISaslCallbackHandler handler
+         )
+      {
+         IList mechs = mechanisms;
+         if ( mechs.Contains(ExternalSaslClient.Mechanism) )
+            return new ExternalSaslClient(authorizationId, props, handler);
+         if ( mechs.Contains(DigestSaslClient.Mechanism) )
+            return new DigestSaslClient(authorizationId, serverName, protocol, props, handler);
+         if ( mechs.Contains(CramMD5SaslClient.Mechanism) )
+            return new CramMD5SaslClient(authorizationId, props, handler);
+         if ( mechs.Contains(CramMD5HexSaslClient.Mechanism) )
+            return new CramMD5HexSaslClient(authorizationId, props, handler);
+         if ( mechs.Contains(PlainSaslClient.Mechanism) )
+            return new PlainSaslClient(authorizationId, props, handler);
+         if ( mechs.Contains(AnonymousSaslClient.Mechanism) )
+            return new AnonymousSaslClient(authorizationId, props, handler);
+         // unknown mechanism
+         return null;
+      }
+   } // class DefaultClientFactory
+
+} // namespace Apache.Qpid.Sasl
+
+

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/DefaultClientFactory.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslCallbackHandler.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslCallbackHandler.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslCallbackHandler.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslCallbackHandler.cs Thu Dec  3 23:55:48 2009
@@ -1,35 +1,35 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Text;
-
-namespace Apache.Qpid.Sasl
-{
-   public interface ISaslCallbackHandler
-   {
-      void Handle(ISaslCallback[] callbacks);
-
-   } // interface ISaslCallbackHandler
-
-} // namespace Apache.Qpid.Sasl
-
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Text;
+
+namespace Apache.Qpid.Sasl
+{
+   public interface ISaslCallbackHandler
+   {
+      void Handle(ISaslCallback[] callbacks);
+
+   } // interface ISaslCallbackHandler
+
+} // namespace Apache.Qpid.Sasl
+
+

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslCallbackHandler.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslClient.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslClient.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslClient.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslClient.cs Thu Dec  3 23:55:48 2009
@@ -1,42 +1,42 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Text;
-
-namespace Apache.Qpid.Sasl
-{
-   public interface ISaslClient
-   {
-      string MechanismName { get; }
-      bool HasInitialResponse { get; }
-      bool IsComplete { get; }
-
-      byte[] EvaluateChallenge(byte[] challenge);
-      object GetNegotiatedProperty(string propName);
-      byte[] Unwrap(byte[] buffer, int offset, int length);
-      byte[] Wrap(byte[] buffer, int offset, int lenght);
-
-   } // interface ISaslClient
-
-} // namespace Apache.Qpid.Sasl
-
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Text;
+
+namespace Apache.Qpid.Sasl
+{
+   public interface ISaslClient
+   {
+      string MechanismName { get; }
+      bool HasInitialResponse { get; }
+      bool IsComplete { get; }
+
+      byte[] EvaluateChallenge(byte[] challenge);
+      object GetNegotiatedProperty(string propName);
+      byte[] Unwrap(byte[] buffer, int offset, int length);
+      byte[] Wrap(byte[] buffer, int offset, int lenght);
+
+   } // interface ISaslClient
+
+} // namespace Apache.Qpid.Sasl
+
+

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslClient.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslClientFactory.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslClientFactory.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslClientFactory.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslClientFactory.cs Thu Dec  3 23:55:48 2009
@@ -1,40 +1,40 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Text;
-
-namespace Apache.Qpid.Sasl
-{
-   public interface ISaslClientFactory
-   {
-      string[] GetSupportedMechanisms(IDictionary props);
-      ISaslClient CreateClient(
-         string[] mechanisms, string authorizationId, 
-         string protocol, string serverName, 
-         IDictionary props, ISaslCallbackHandler handler
-         );
-   } // interface ISaslClientFactory
-
-} // namespace Apache.Qpid.Sasl
-
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace Apache.Qpid.Sasl
+{
+   public interface ISaslClientFactory
+   {
+      string[] GetSupportedMechanisms(IDictionary props);
+      ISaslClient CreateClient(
+         string[] mechanisms, string authorizationId, 
+         string protocol, string serverName, 
+         IDictionary props, ISaslCallbackHandler handler
+         );
+   } // interface ISaslClientFactory
+
+} // namespace Apache.Qpid.Sasl
+
+

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/ISaslClientFactory.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/MD5HMAC.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/MD5HMAC.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/MD5HMAC.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/MD5HMAC.cs Thu Dec  3 23:55:48 2009
@@ -1,115 +1,115 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Security.Cryptography;
-
-namespace Apache.Qpid.Sasl
-{
-   /// <summary>
-   /// Rough HMAC MD5 implementation as presented in
-   /// RFC 2104. Used because the HMACMD5 class in the 
-   /// .NET framework is not available in v1.1.
-   /// </summary>
-   public sealed class MD5HMAC : IDisposable
-   {
-      private const int BLOCK_LEN = 64;
-      private MD5 _hash;
-      private byte[] _key;
-      private byte[] _ipad;
-      private byte[] _opad;
-
-      public MD5HMAC(byte[] key)
-      {
-         if ( key == null || key.Length == 0 )
-            throw new ArgumentNullException("key");
-
-         _hash = new MD5CryptoServiceProvider();
-
-         byte[] theKey = key;
-         if ( theKey.Length > BLOCK_LEN )
-         {
-            theKey = _hash.ComputeHash(theKey);
-         }
-         // pad key with 0's up to BLOCK_LEN
-         _key = new byte[BLOCK_LEN];
-         Array.Copy(theKey, _key, theKey.Length);
-
-         CreatePads();
-      }
-
-      public byte[] ComputeHash(byte[] input)
-      {
-         // H(K XOR opad, H(K XOR ipad, text))
-         return H(_opad, H(_ipad, input));
-      }
-
-      public void Dispose()
-      {
-         if ( _hash != null )
-         {
-            ((IDisposable)_hash).Dispose();
-            _hash = null;
-         }
-      }
-
-      #region Private Methods
-      //
-      // Private Methods
-      //
-
-      private void CreatePads()
-      {
-         _ipad = new byte[BLOCK_LEN];
-         _opad = new byte[BLOCK_LEN];
-         for ( int i = 0; i < BLOCK_LEN; i++ )
-         {
-            _ipad[i] = 0x36;
-            _opad[i] = 0x5c;
-         }
-
-         XOR(_ipad, _key);
-         XOR(_opad, _key);
-      }
-
-      private static void XOR(byte[] dest, byte[] other)
-      {
-         // assume both are same size
-         for ( int i = 0; i < dest.Length; i++ )
-         {
-            dest[i] ^= other[i];
-         }
-      }
-
-      private byte[] H(byte[] v1, byte[] v2)
-      {
-         byte[] total = new byte[v1.Length + v2.Length];
-         Array.Copy(v1, total, v1.Length);
-         Array.Copy(v2, 0, total, v1.Length, v2.Length);
-
-         return _hash.ComputeHash(total);
-      }
-
-      #endregion // Private Methods
-
-   } // class MD5HMAC
-
-} // namespace Apache.Qpid.Sasl
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Security.Cryptography;
+
+namespace Apache.Qpid.Sasl
+{
+   /// <summary>
+   /// Rough HMAC MD5 implementation as presented in
+   /// RFC 2104. Used because the HMACMD5 class in the 
+   /// .NET framework is not available in v1.1.
+   /// </summary>
+   public sealed class MD5HMAC : IDisposable
+   {
+      private const int BLOCK_LEN = 64;
+      private MD5 _hash;
+      private byte[] _key;
+      private byte[] _ipad;
+      private byte[] _opad;
+
+      public MD5HMAC(byte[] key)
+      {
+         if ( key == null || key.Length == 0 )
+            throw new ArgumentNullException("key");
+
+         _hash = new MD5CryptoServiceProvider();
+
+         byte[] theKey = key;
+         if ( theKey.Length > BLOCK_LEN )
+         {
+            theKey = _hash.ComputeHash(theKey);
+         }
+         // pad key with 0's up to BLOCK_LEN
+         _key = new byte[BLOCK_LEN];
+         Array.Copy(theKey, _key, theKey.Length);
+
+         CreatePads();
+      }
+
+      public byte[] ComputeHash(byte[] input)
+      {
+         // H(K XOR opad, H(K XOR ipad, text))
+         return H(_opad, H(_ipad, input));
+      }
+
+      public void Dispose()
+      {
+         if ( _hash != null )
+         {
+            ((IDisposable)_hash).Dispose();
+            _hash = null;
+         }
+      }
+
+      #region Private Methods
+      //
+      // Private Methods
+      //
+
+      private void CreatePads()
+      {
+         _ipad = new byte[BLOCK_LEN];
+         _opad = new byte[BLOCK_LEN];
+         for ( int i = 0; i < BLOCK_LEN; i++ )
+         {
+            _ipad[i] = 0x36;
+            _opad[i] = 0x5c;
+         }
+
+         XOR(_ipad, _key);
+         XOR(_opad, _key);
+      }
+
+      private static void XOR(byte[] dest, byte[] other)
+      {
+         // assume both are same size
+         for ( int i = 0; i < dest.Length; i++ )
+         {
+            dest[i] ^= other[i];
+         }
+      }
+
+      private byte[] H(byte[] v1, byte[] v2)
+      {
+         byte[] total = new byte[v1.Length + v2.Length];
+         Array.Copy(v1, total, v1.Length);
+         Array.Copy(v2, 0, total, v1.Length, v2.Length);
+
+         return _hash.ComputeHash(total);
+      }
+
+      #endregion // Private Methods
+
+   } // class MD5HMAC
+
+} // namespace Apache.Qpid.Sasl

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/MD5HMAC.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/AnonymousSaslClient.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/AnonymousSaslClient.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/AnonymousSaslClient.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/AnonymousSaslClient.cs Thu Dec  3 23:55:48 2009
@@ -1,69 +1,69 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Text;
-
-namespace Apache.Qpid.Sasl.Mechanisms
-{
-   /// <summary>
-   /// Implements the ANONYMOUS authentication mechanism
-   /// as outlined in RFC 2245
-   /// </summary>
-   public class AnonymousSaslClient : SaslClient
-   {
-      public const string Mechanism = "ANONYMOUS";
-
-      public AnonymousSaslClient(
-         string authid, IDictionary properties, 
-         ISaslCallbackHandler handler)
-         : base(authid, null, null, properties, handler)
-      {
-      }
-
-      #region ISaslClient Implementation
-      //
-      // ISaslClient Implementation
-      //
-
-      public override string MechanismName
-      {
-         get { return Mechanism; }
-      }
-
-      public override bool HasInitialResponse
-      {
-         get { return true; }
-      }
-
-      public override byte[] EvaluateChallenge(byte[] challenge)
-      {
-         // ignore challenge
-         SetComplete();
-         return Encoding.UTF8.GetBytes(AuthorizationId);
-      }
-
-      #endregion // ISaslClient Implementation
-
-   } // class AnonymousSaslClient
-
-} // namespace Apache.Qpid.Sasl.Mechanisms
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Collections;
+using System.Text;
+
+namespace Apache.Qpid.Sasl.Mechanisms
+{
+   /// <summary>
+   /// Implements the ANONYMOUS authentication mechanism
+   /// as outlined in RFC 2245
+   /// </summary>
+   public class AnonymousSaslClient : SaslClient
+   {
+      public const string Mechanism = "ANONYMOUS";
+
+      public AnonymousSaslClient(
+         string authid, IDictionary properties, 
+         ISaslCallbackHandler handler)
+         : base(authid, null, null, properties, handler)
+      {
+      }
+
+      #region ISaslClient Implementation
+      //
+      // ISaslClient Implementation
+      //
+
+      public override string MechanismName
+      {
+         get { return Mechanism; }
+      }
+
+      public override bool HasInitialResponse
+      {
+         get { return true; }
+      }
+
+      public override byte[] EvaluateChallenge(byte[] challenge)
+      {
+         // ignore challenge
+         SetComplete();
+         return Encoding.UTF8.GetBytes(AuthorizationId);
+      }
+
+      #endregion // ISaslClient Implementation
+
+   } // class AnonymousSaslClient
+
+} // namespace Apache.Qpid.Sasl.Mechanisms

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/AnonymousSaslClient.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/CramMD5HexSaslClient.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/CramMD5HexSaslClient.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/CramMD5HexSaslClient.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/CramMD5HexSaslClient.cs Thu Dec  3 23:55:48 2009
@@ -1,93 +1,93 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Security.Cryptography;
-using System.Text;
-
-namespace Apache.Qpid.Sasl.Mechanisms
-{
-   /// <summary>
-   /// Implements the CRAM-MD5 authentication mechanism as outlined
-   /// in RFC 2195
-   /// </summary>
-   public class CramMD5HexSaslClient : SaslClient
-   {
-      public const string Mechanism = "CRAM-MD5-HEX";
-      private const int MinPwdLen = 16;
-
-      public CramMD5HexSaslClient(
-         string authorizationId, 
-         IDictionary properties, 
-         ISaslCallbackHandler handler)
-         : base(authorizationId, null, null, properties, handler)
-      {
-      }
-
-      #region ISaslClient Implementation
-      //
-      // ISaslClient Implementation
-      //
-
-      public override string MechanismName
-      {
-         get { return Mechanism; }
-      }
-
-      public override bool HasInitialResponse
-      {
-         get { return false; }
-      }
-      
-      
-      public override byte[] EvaluateChallenge(byte[] challenge)
-      {
-        if ( challenge == null || challenge.Length == 0 )
-            throw new ArgumentNullException("challenge");
-
-
-        NameCallback nameCB = new NameCallback(AuthorizationId);
-        PasswordCallback pwdCB = new PasswordCallback();
-        ISaslCallback[] callbacks = { nameCB, pwdCB };
-        Handler.Handle(callbacks);
-
-        string username = nameCB.Text;
-        
-        //Encode the Hashed Password as Hex
-        byte[] passwd = Encoding.UTF8.GetBytes(ToHex(pwdCB.HashedText));
-
-        string s = System.Text.UTF8Encoding.UTF8.GetString(challenge);
-        
-        using ( HMAC hmac = new HMACMD5(passwd) )
-         {
-            byte[] value = hmac.ComputeHash(challenge);
-            string encoded = ToHex(value);
-            SetComplete();
-            return Encoding.UTF8.GetBytes(username + " " + encoded);
-         }
-      }
-
-      #endregion // ISaslClient Implementation
-
-   } // class CramMD5HashedSaslClient
-
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Collections;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace Apache.Qpid.Sasl.Mechanisms
+{
+   /// <summary>
+   /// Implements the CRAM-MD5 authentication mechanism as outlined
+   /// in RFC 2195
+   /// </summary>
+   public class CramMD5HexSaslClient : SaslClient
+   {
+      public const string Mechanism = "CRAM-MD5-HEX";
+      private const int MinPwdLen = 16;
+
+      public CramMD5HexSaslClient(
+         string authorizationId, 
+         IDictionary properties, 
+         ISaslCallbackHandler handler)
+         : base(authorizationId, null, null, properties, handler)
+      {
+      }
+
+      #region ISaslClient Implementation
+      //
+      // ISaslClient Implementation
+      //
+
+      public override string MechanismName
+      {
+         get { return Mechanism; }
+      }
+
+      public override bool HasInitialResponse
+      {
+         get { return false; }
+      }
+      
+      
+      public override byte[] EvaluateChallenge(byte[] challenge)
+      {
+        if ( challenge == null || challenge.Length == 0 )
+            throw new ArgumentNullException("challenge");
+
+
+        NameCallback nameCB = new NameCallback(AuthorizationId);
+        PasswordCallback pwdCB = new PasswordCallback();
+        ISaslCallback[] callbacks = { nameCB, pwdCB };
+        Handler.Handle(callbacks);
+
+        string username = nameCB.Text;
+        
+        //Encode the Hashed Password as Hex
+        byte[] passwd = Encoding.UTF8.GetBytes(ToHex(pwdCB.HashedText));
+
+        string s = System.Text.UTF8Encoding.UTF8.GetString(challenge);
+        
+        using ( HMAC hmac = new HMACMD5(passwd) )
+         {
+            byte[] value = hmac.ComputeHash(challenge);
+            string encoded = ToHex(value);
+            SetComplete();
+            return Encoding.UTF8.GetBytes(username + " " + encoded);
+         }
+      }
+
+      #endregion // ISaslClient Implementation
+
+   } // class CramMD5HashedSaslClient
+
 } // namespace Apache.Qpid.Sasl.Mechanisms

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/CramMD5HexSaslClient.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/CramMD5SaslClient.cs
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/CramMD5SaslClient.cs?rev=886998&r1=886997&r2=886998&view=diff
==============================================================================
--- qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/CramMD5SaslClient.cs (original)
+++ qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/CramMD5SaslClient.cs Thu Dec  3 23:55:48 2009
@@ -1,91 +1,91 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *   http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-using System;
-using System.Collections;
-using System.Security.Cryptography;
-using System.Text;
-
-namespace Apache.Qpid.Sasl.Mechanisms
-{
-   /// <summary>
-   /// Implements the CRAM-MD5 authentication mechanism as outlined
-   /// in RFC 2195
-   /// </summary>
-   public class CramMD5SaslClient : SaslClient
-   {
-      public const string Mechanism = "CRAM-MD5";
-      private const int MinPwdLen = 16;
-
-      public CramMD5SaslClient(
-         string authorizationId, 
-         IDictionary properties, 
-         ISaslCallbackHandler handler)
-         : base(authorizationId, null, null, properties, handler)
-      {
-      }
-
-      #region ISaslClient Implementation
-      //
-      // ISaslClient Implementation
-      //
-
-      public override string MechanismName
-      {
-         get { return Mechanism; }
-      }
-
-      public override bool HasInitialResponse
-      {
-         get { return false; }
-      }
-
-      public override byte[] EvaluateChallenge(byte[] challenge)
-      {
-         if ( challenge == null || challenge.Length == 0 )
-            throw new ArgumentNullException("challenge");
-
-         NameCallback nameCB = new NameCallback(AuthorizationId);
-         PasswordCallback pwdCB = new PasswordCallback();
-         ISaslCallback[] callbacks = { nameCB, pwdCB };
-         Handler.Handle(callbacks);
-
-         string username = nameCB.Text;
-         string passwd = pwdCB.Text.PadRight(MinPwdLen, '\0');
-
-         byte[] secret = Encoding.UTF8.GetBytes(passwd);
-
-         //using ( HMAC hmac = new HMACMD5(secret) )
-         using ( MD5HMAC hmac = new MD5HMAC(secret) )
-         {
-            byte[] value = hmac.ComputeHash(challenge);
-            string encoded = ToHex(value);
-            SetComplete();
-            return Encoding.UTF8.GetBytes(username + " " + encoded);
-         }
-
-      }
-
-      #endregion // ISaslClient Implementation
-
-   } // class CramMD5SaslClient
-
-} // namespace Apache.Qpid.Sasl.Mechanisms
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+using System;
+using System.Collections;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace Apache.Qpid.Sasl.Mechanisms
+{
+   /// <summary>
+   /// Implements the CRAM-MD5 authentication mechanism as outlined
+   /// in RFC 2195
+   /// </summary>
+   public class CramMD5SaslClient : SaslClient
+   {
+      public const string Mechanism = "CRAM-MD5";
+      private const int MinPwdLen = 16;
+
+      public CramMD5SaslClient(
+         string authorizationId, 
+         IDictionary properties, 
+         ISaslCallbackHandler handler)
+         : base(authorizationId, null, null, properties, handler)
+      {
+      }
+
+      #region ISaslClient Implementation
+      //
+      // ISaslClient Implementation
+      //
+
+      public override string MechanismName
+      {
+         get { return Mechanism; }
+      }
+
+      public override bool HasInitialResponse
+      {
+         get { return false; }
+      }
+
+      public override byte[] EvaluateChallenge(byte[] challenge)
+      {
+         if ( challenge == null || challenge.Length == 0 )
+            throw new ArgumentNullException("challenge");
+
+         NameCallback nameCB = new NameCallback(AuthorizationId);
+         PasswordCallback pwdCB = new PasswordCallback();
+         ISaslCallback[] callbacks = { nameCB, pwdCB };
+         Handler.Handle(callbacks);
+
+         string username = nameCB.Text;
+         string passwd = pwdCB.Text.PadRight(MinPwdLen, '\0');
+
+         byte[] secret = Encoding.UTF8.GetBytes(passwd);
+
+         //using ( HMAC hmac = new HMACMD5(secret) )
+         using ( MD5HMAC hmac = new MD5HMAC(secret) )
+         {
+            byte[] value = hmac.ComputeHash(challenge);
+            string encoded = ToHex(value);
+            SetComplete();
+            return Encoding.UTF8.GetBytes(username + " " + encoded);
+         }
+
+      }
+
+      #endregion // ISaslClient Implementation
+
+   } // class CramMD5SaslClient
+
+} // namespace Apache.Qpid.Sasl.Mechanisms

Propchange: qpid/trunk/qpid/dotnet/Qpid.Sasl/Mechanisms/CramMD5SaslClient.cs
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message