diff options
| author | Tomas Restrepo <tomasr@apache.org> | 2007-05-13 23:08:40 +0000 |
|---|---|---|
| committer | Tomas Restrepo <tomasr@apache.org> | 2007-05-13 23:08:40 +0000 |
| commit | 736eb917ebd8a1a007dde5af12257b390ae40108 (patch) | |
| tree | eb8149a24458dda0b45920af0439b9fa07175392 /dotnet/Qpid.Client/Client/Security/CallbackHandlerRegistry.cs | |
| parent | 1a1a11c09f75b72744c6f8e1c6e1a567eeae3886 (diff) | |
| download | qpid-python-736eb917ebd8a1a007dde5af12257b390ae40108.tar.gz | |
Merged revisions 537673 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2
........
r537673 | tomasr | 2007-05-13 18:03:30 -0500 (Sun, 13 May 2007) | 3 lines
* QPID-486 Choose strongest SASL Mechanism first
* Remove unnecessary wrapping of AMQExceptions on connection failure
........
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@537676 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/Qpid.Client/Client/Security/CallbackHandlerRegistry.cs')
| -rw-r--r-- | dotnet/Qpid.Client/Client/Security/CallbackHandlerRegistry.cs | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/dotnet/Qpid.Client/Client/Security/CallbackHandlerRegistry.cs b/dotnet/Qpid.Client/Client/Security/CallbackHandlerRegistry.cs index 944d21ad92..546bcec35a 100644 --- a/dotnet/Qpid.Client/Client/Security/CallbackHandlerRegistry.cs +++ b/dotnet/Qpid.Client/Client/Security/CallbackHandlerRegistry.cs @@ -70,7 +70,7 @@ namespace Qpid.Client.Security {
private static CallbackHandlerRegistry _instance =
new CallbackHandlerRegistry();
- private IDictionary _mechanism2HandlerMap;
+ private OrderedHashTable _mechanism2HandlerMap;
private string[] _mechanisms;
public static CallbackHandlerRegistry Instance
@@ -85,12 +85,12 @@ namespace Qpid.Client.Security private CallbackHandlerRegistry()
{
- _mechanism2HandlerMap = (IDictionary)
+ _mechanism2HandlerMap = (OrderedHashTable)
ConfigurationSettings.GetConfig("qpid.client/authentication");
// configure default options if not available
if ( _mechanism2HandlerMap == null )
- _mechanism2HandlerMap = new Hashtable();
+ _mechanism2HandlerMap = new OrderedHashTable();
if ( !_mechanism2HandlerMap.Contains(ExternalSaslClient.Mechanism) )
_mechanism2HandlerMap.Add(ExternalSaslClient.Mechanism, typeof(UsernamePasswordCallbackHandler));
@@ -99,8 +99,8 @@ namespace Qpid.Client.Security if ( !_mechanism2HandlerMap.Contains(PlainSaslClient.Mechanism) )
_mechanism2HandlerMap.Add(PlainSaslClient.Mechanism, typeof(UsernamePasswordCallbackHandler));
- _mechanisms = new string[_mechanism2HandlerMap.Keys.Count];
- _mechanism2HandlerMap.Keys.CopyTo(_mechanisms, 0);
+ _mechanisms = new string[_mechanism2HandlerMap.Count];
+ _mechanism2HandlerMap.OrderedKeys.CopyTo(_mechanisms, 0);
}
public bool IsSupportedMechanism(string mechanism)
@@ -108,6 +108,17 @@ namespace Qpid.Client.Security return _mechanism2HandlerMap.Contains(mechanism);
}
+ public string ChooseMechanism(string mechanisms)
+ {
+ IList mechs = mechanisms.Split(' ');
+ foreach ( string supportedMech in _mechanisms )
+ {
+ if ( mechs.Contains(supportedMech) )
+ return supportedMech;
+ }
+ return null;
+ }
+
public Type GetCallbackHandler(string mechanism)
{
return (Type)_mechanism2HandlerMap[mechanism];
|
