Author: atsushi
Date: 2007-02-26 09:23:52 -0500 (Mon, 26 Feb 2007)
New Revision: 73426

Modified:
   trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SecureMessageDecryptor.cs
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSEncryptedXml.cs
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSSecurityMessageHeader.cs
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSSignedXml.cs
Log:
2007-02-26  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * SecureMessageDecryptor.cs : fix exception message.
        * WSSecurityMessageHeader.cs, WSSignedXml.cs, WSEncryptedXml.cs :
          XmlNamespaceManager is not required for GetIdElement().



Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog    
    2007-02-26 13:44:45 UTC (rev 73425)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog    
    2007-02-26 14:23:52 UTC (rev 73426)
@@ -1,3 +1,9 @@
+2007-02-26  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
+       * SecureMessageDecryptor.cs : fix exception message.
+       * WSSecurityMessageHeader.cs, WSSignedXml.cs, WSEncryptedXml.cs :
+         XmlNamespaceManager is not required for GetIdElement().
+
 2007-02-22  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
        * SecureMessageDecryptor.cs, WSSecurityMessageHeader.cs :

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SecureMessageDecryptor.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SecureMessageDecryptor.cs
        2007-02-26 13:44:45 UTC (rev 73425)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SecureMessageDecryptor.cs
        2007-02-26 14:23:52 UTC (rev 73426)
@@ -383,7 +383,7 @@
                                        if (optional)
                                                continue;
                                        else
-                                               throw new 
MessageSecurityException ("Security token '{0}' cannot be validated according 
to the security settings.");
+                                               throw new 
MessageSecurityException (String.Format ("No security token could be validated 
for authenticator '{0}' which is indicated by the security token parameters", 
a));
                                }
                                sec_prop.IncomingSupportingTokens.Add (spec);
                        }

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSEncryptedXml.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSEncryptedXml.cs
        2007-02-26 13:44:45 UTC (rev 73425)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSEncryptedXml.cs
        2007-02-26 14:23:52 UTC (rev 73426)
@@ -34,23 +34,33 @@
        // See http://blogs.msdn.com/shawnfa/archive/2004/04/05/108098.aspx :)
        class WSEncryptedXml : EncryptedXml
        {
-               XmlNamespaceManager nsmgr;
-
-               public WSEncryptedXml (XmlNamespaceManager nsmgr)
+               public WSEncryptedXml ()
                {
-                       this.nsmgr = nsmgr;
                }
 
-               public WSEncryptedXml (XmlNamespaceManager nsmgr, XmlDocument 
doc)
+               public WSEncryptedXml (XmlDocument doc)
                        : base (doc)
                {
-                       this.nsmgr = nsmgr;
                }
 
                public override XmlElement GetIdElement (XmlDocument doc, 
string id)
                {
-                       XmlElement el = doc.SelectSingleNode ("//[EMAIL 
PROTECTED]:Id = '" + id + "']", nsmgr) as XmlElement;
-                       return el != null ? el : base.GetIdElement (doc, id);
+                       return SearchChildren (doc, id);
                }
+
+               XmlElement SearchChildren (XmlNode node, string id)
+               {
+                       for (XmlNode n = node.FirstChild; n != null; n = 
n.NextSibling) {
+                               XmlElement el = n as XmlElement;
+                               if (el == null)
+                                       continue;
+                               if (el.GetAttribute ("Id", 
Constants.WsuNamespace) == id || el.GetAttribute ("Id") == id)
+                                       return el;
+                               XmlElement el2 = SearchChildren (el, id);
+                               if (el2 != null)
+                                       return el2;
+                       }
+                       return null;
+               }
        }
 }

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSSecurityMessageHeader.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSSecurityMessageHeader.cs
       2007-02-26 13:44:45 UTC (rev 73425)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSSecurityMessageHeader.cs
       2007-02-26 14:23:52 UTC (rev 73426)
@@ -115,7 +115,7 @@
                        case SignedXml.XmlDsigNamespaceUrl:
                                switch (reader.LocalName) {
                                case "Signature":
-                                       WSSignedXml sxml = new WSSignedXml 
(nsmgr, doc);
+                                       WSSignedXml sxml = new WSSignedXml 
(doc);
                                        sxml.Signature.LoadXml ((XmlElement) 
doc.ReadNode (reader));
                                        UpdateSignatureKeyInfo (sxml.Signature, 
doc, serializer);
                                        return sxml;
@@ -180,7 +180,7 @@
                // returns the protection token
                public void DecryptSecurity (SecureMessageDecryptor decryptor, 
WrappedKeySecurityToken wk, byte [] dummyEncKey)
                {
-                       WSEncryptedXml encXml = new WSEncryptedXml (nsmgr, doc);
+                       WSEncryptedXml encXml = new WSEncryptedXml (doc);
 
                        // default, unless overriden by the default 
DerivedKeyToken.
                        Rijndael aes = RijndaelManaged.Create (); // it is 
reused with every key

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSSignedXml.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSSignedXml.cs
   2007-02-26 13:44:45 UTC (rev 73425)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/WSSignedXml.cs
   2007-02-26 14:23:52 UTC (rev 73426)
@@ -34,23 +34,33 @@
        // See http://blogs.msdn.com/shawnfa/archive/2004/04/05/108098.aspx :)
        class WSSignedXml : SignedXml
        {
-               XmlNamespaceManager nsmgr;
-
-               public WSSignedXml (XmlNamespaceManager nsmgr)
+               public WSSignedXml ()
                {
-                       this.nsmgr = nsmgr;
                }
 
-               public WSSignedXml (XmlNamespaceManager nsmgr, XmlDocument doc)
+               public WSSignedXml (XmlDocument doc)
                        : base (doc)
                {
-                       this.nsmgr = nsmgr;
                }
 
                public override XmlElement GetIdElement (XmlDocument doc, 
string id)
                {
-                       XmlElement el = doc.SelectSingleNode ("//[EMAIL 
PROTECTED]:Id = '" + id + "']", nsmgr) as XmlElement;
-                       return el != null ? el : base.GetIdElement (doc, id);
+                       return SearchChildren (doc, id);
                }
+
+               XmlElement SearchChildren (XmlNode node, string id)
+               {
+                       for (XmlNode n = node.FirstChild; n != null; n = 
n.NextSibling) {
+                               XmlElement el = n as XmlElement;
+                               if (el == null)
+                                       continue;
+                               if (el.GetAttribute ("Id", 
Constants.WsuNamespace) == id || el.GetAttribute ("Id") == id)
+                                       return el;
+                               XmlElement el2 = SearchChildren (el, id);
+                               if (el2 != null)
+                                       return el2;
+                       }
+                       return null;
+               }
        }
 }

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

Reply via email to