Author: atsushi
Date: 2007-01-11 02:59:44 -0500 (Thu, 11 Jan 2007)
New Revision: 70836

Modified:
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/AsymmetricSecurityBindingElement.cs
   trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/MessageSecurityBindingSupport.cs
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SecureMessageGenerator.cs
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SymmetricSecurityBindingElement.cs
Log:
2007-01-11  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * SecureMessageGenerator.cs : encryption parts should exist too.
        * AsymmetricSecurityBindingElement.cs
          SymmetricSecurityBindingElement.cs,
          MessageSecurityBindingSupport.cs : some refactoring.
          Split MessageSecurityBindingSupport into security binding element
          specific parts and made MessageSecurityBindingSupport concrete.
          It is likely split again, next time based on initiator/recipient.



Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/AsymmetricSecurityBindingElement.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/AsymmetricSecurityBindingElement.cs
      2007-01-11 07:20:53 UTC (rev 70835)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/AsymmetricSecurityBindingElement.cs
      2007-01-11 07:59:44 UTC (rev 70836)
@@ -140,7 +140,7 @@
                                
context.BindingParameters.Find<ChannelProtectionRequirements> ();
 
                        return new SecurityChannelFactory<TChannel> (
-                               context.BuildInnerChannelFactory<TChannel> (), 
new AsymmetricSecurityBindingSupport (this, manager, requirements));
+                               context.BuildInnerChannelFactory<TChannel> (), 
new MessageSecurityBindingSupport (this, manager, requirements));
                }
 
                [MonoTODO]
@@ -165,7 +165,7 @@
                                
context.BindingParameters.Find<ChannelProtectionRequirements> ();
 
                        return new SecurityChannelListener<TChannel> (
-                               context.BuildInnerChannelListener<TChannel> (), 
new AsymmetricSecurityBindingSupport (this, manager, requirements));
+                               context.BuildInnerChannelListener<TChannel> (), 
new MessageSecurityBindingSupport (this, manager, requirements));
                }
 
                public override BindingElement Clone ()

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog    
    2007-01-11 07:20:53 UTC (rev 70835)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog    
    2007-01-11 07:59:44 UTC (rev 70836)
@@ -1,5 +1,15 @@
 2007-01-11  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * SecureMessageGenerator.cs : encryption parts should exist too.
+       * AsymmetricSecurityBindingElement.cs
+         SymmetricSecurityBindingElement.cs,
+         MessageSecurityBindingSupport.cs : some refactoring.
+         Split MessageSecurityBindingSupport into security binding element
+         specific parts and made MessageSecurityBindingSupport concrete.
+         It is likely split again, next time based on initiator/recipient.
+
+2007-01-11  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * MessageSecurityUtility.cs, SecureMessageGenerator.cs :
          split encryptor part in the former file into latter file, and
          make it nonstatic.

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/MessageSecurityBindingSupport.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/MessageSecurityBindingSupport.cs
 2007-01-11 07:20:53 UTC (rev 70835)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/MessageSecurityBindingSupport.cs
 2007-01-11 07:59:44 UTC (rev 70836)
@@ -66,7 +66,7 @@
                }
        }
 
-       internal abstract class MessageSecurityBindingSupport
+       internal class MessageSecurityBindingSupport
        {
                SecurityTokenManager manager;
                ChannelProtectionRequirements requirements;
@@ -79,11 +79,29 @@
                SecurityTokenResolver auth_token_resolver;
                ChannelFactoryBase factory; // only for client
                ChannelListenerBase listener; // only for service
+               SecurityBindingElementSupport element_support;
 
-               protected MessageSecurityBindingSupport (
+               public MessageSecurityBindingSupport (
+                       AsymmetricSecurityBindingElement element,
                        SecurityTokenManager manager,
                        ChannelProtectionRequirements requirements)
                {
+                       element_support = new 
AsymmetricSecurityBindingElementSupport (element);
+                       Initialize (manager, requirements);
+               }
+
+               public MessageSecurityBindingSupport (
+                       SymmetricSecurityBindingElement element,
+                       SecurityTokenManager manager,
+                       ChannelProtectionRequirements requirements)
+               {
+                       element_support = new 
SymmetricSecurityBindingElementSupport (element);
+                       Initialize (manager, requirements);
+               }
+
+               public void Initialize (SecurityTokenManager manager,
+                       ChannelProtectionRequirements requirements)
+               {
                        this.manager = manager;
                        if (requirements == null)
                                requirements = new 
ChannelProtectionRequirements ();
@@ -122,15 +140,38 @@
                        get { return signing_token; }
                }
 
-               public abstract SecurityBindingElement Element { get; }
-               public abstract bool AllowSerializedSigningTokenOnReply { get; }
-               public abstract MessageProtectionOrder MessageProtectionOrder { 
get; }
-               public abstract SecurityTokenParameters InitiatorParameters { 
get; }
-               public abstract SecurityTokenParameters RecipientParameters { 
get; }
-               public abstract bool RequireSignatureConfirmation { get; }
+               #region element_support
 
-               public abstract string DefaultSignatureAlgorithm { get; }
+               public SecurityBindingElement Element {
+                       get { return element_support.Element; }
+               }
 
+               public bool AllowSerializedSigningTokenOnReply {
+                       get { return 
element_support.AllowSerializedSigningTokenOnReply; }
+               }
+
+               public MessageProtectionOrder MessageProtectionOrder { 
+                       get { return element_support.MessageProtectionOrder; }
+               }
+
+               public SecurityTokenParameters InitiatorParameters { 
+                       get { return element_support.InitiatorParameters; }
+               }
+
+               public SecurityTokenParameters RecipientParameters { 
+                       get { return element_support.RecipientParameters; }
+               }
+
+               public bool RequireSignatureConfirmation {
+                       get { return 
element_support.RequireSignatureConfirmation; }
+               }
+
+               public string DefaultSignatureAlgorithm {
+                       get { return element_support.DefaultSignatureAlgorithm; 
}
+               }
+
+               #endregion
+
                public SecurityTokenProvider CreateTokenProvider 
(SecurityTokenRequirement requirement)
                {
                        return manager.CreateSecurityTokenProvider 
(requirement);
@@ -381,17 +422,29 @@
                }
        }
 
-       // concrete implementations
+       internal abstract class SecurityBindingElementSupport
+       {
+               public abstract SecurityBindingElement Element { get; }
 
-       internal class SymmetricSecurityBindingSupport : 
MessageSecurityBindingSupport
+               public abstract bool AllowSerializedSigningTokenOnReply { get; }
+
+               public abstract MessageProtectionOrder MessageProtectionOrder { 
get; }
+
+               public abstract SecurityTokenParameters InitiatorParameters { 
get; }
+
+               public abstract SecurityTokenParameters RecipientParameters { 
get; }
+
+               public abstract bool RequireSignatureConfirmation { get; }
+
+               public abstract string DefaultSignatureAlgorithm { get; }
+       }
+
+       internal class SymmetricSecurityBindingElementSupport : 
SecurityBindingElementSupport
        {
                SymmetricSecurityBindingElement element;
 
-               public SymmetricSecurityBindingSupport (
-                       SymmetricSecurityBindingElement element,
-                       SecurityTokenManager manager,
-                       ChannelProtectionRequirements requirements)
-                       : base (manager, requirements)
+               public SymmetricSecurityBindingElementSupport (
+                       SymmetricSecurityBindingElement element)
                {
                        this.element = element;
                }
@@ -426,15 +479,12 @@
                }
        }
 
-       internal class AsymmetricSecurityBindingSupport : 
MessageSecurityBindingSupport
+       internal class AsymmetricSecurityBindingElementSupport : 
SecurityBindingElementSupport
        {
                AsymmetricSecurityBindingElement element;
 
-               public AsymmetricSecurityBindingSupport (
-                       AsymmetricSecurityBindingElement element,
-                       SecurityTokenManager manager,
-                       ChannelProtectionRequirements requirements)
-                       : base (manager, requirements)
+               public AsymmetricSecurityBindingElementSupport (
+                       AsymmetricSecurityBindingElement element)
                {
                        this.element = element;
                }

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SecureMessageGenerator.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SecureMessageGenerator.cs
        2007-01-11 07:20:53 UTC (rev 70835)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SecureMessageGenerator.cs
        2007-01-11 07:59:44 UTC (rev 70836)
@@ -97,10 +97,14 @@
                        throw new Exception ("Internal Error: should not 
happen.");
                }
 
-               public override ScopedMessagePartSpecification MessageParts { 
+               public override ScopedMessagePartSpecification SignatureParts { 
                        get { return 
Security.ChannelRequirements.IncomingSignatureParts; }
                }
 
+               public override ScopedMessagePartSpecification EncryptionParts 
{ 
+                       get { return 
Security.ChannelRequirements.IncomingEncryptionParts; }
+               }
+
                public override SupportingTokenInfoCollection 
CollectInitiatorSupportingTokens ()
                {
                        return Security.CollectInitiatorSupportingTokens 
(GetAction (), MessageTo);
@@ -142,10 +146,14 @@
                        throw new Exception ("Internal Error: should not 
happen.");
                }
 
-               public override ScopedMessagePartSpecification MessageParts { 
+               public override ScopedMessagePartSpecification SignatureParts { 
                        get { return 
Security.ChannelRequirements.OutgoingSignatureParts; }
                }
 
+               public override ScopedMessagePartSpecification EncryptionParts 
{ 
+                       get { return 
Security.ChannelRequirements.OutgoingEncryptionParts; }
+               }
+
                public override SupportingTokenInfoCollection 
CollectInitiatorSupportingTokens ()
                {
                        return Security.CollectRecipientSupportingTokens 
(GetAction (), listen_uri);
@@ -176,8 +184,28 @@
 
                public abstract EndpointAddress MessageTo { get; }
 
-               public abstract ScopedMessagePartSpecification MessageParts { 
get; }
+               public abstract ScopedMessagePartSpecification SignatureParts { 
get; }
 
+               public abstract ScopedMessagePartSpecification EncryptionParts 
{ get; }
+
+               public MessagePartSpecification SignaturePart {
+                       get {
+                               MessagePartSpecification spec;
+                               if (!SignatureParts.TryGetParts (GetAction (), 
false, out spec))
+                                       spec = SignatureParts.ChannelParts;
+                               return spec;
+                       }
+               }
+
+               public MessagePartSpecification EncryptionPart {
+                       get {
+                               MessagePartSpecification spec;
+                               if (!EncryptionParts.TryGetParts (GetAction (), 
false, out spec))
+                                       spec = EncryptionParts.ChannelParts;
+                               return spec;
+                       }
+               }
+
                public abstract SupportingTokenInfoCollection 
CollectInitiatorSupportingTokens ();
 
                public abstract bool ShouldIncludeToken 
(SecurityTokenInclusionMode mode, bool isInitialized);
@@ -200,7 +228,6 @@
                                security.Element;
                        SecurityAlgorithmSuite suite = 
element.DefaultAlgorithmSuite;
 
-                       ScopedMessagePartSpecification spec = MessageParts;
                        // FIXME: is it correct? anyways we need to encrypt 
parts based on supporting tokens too.
                        SecurityTokenParameters securingParams =
                                Direction == MessageDirection.Input ?
@@ -279,9 +306,7 @@
                        case MessageProtectionOrder.SignBeforeEncrypt:
                        case 
MessageProtectionOrder.SignBeforeEncryptAndEncryptSignature:
 
-                               MessagePartSpecification sigSpec;
-                               if (!spec.TryGetParts (GetAction (), false, out 
sigSpec))
-                                       sigSpec = spec.ChannelParts;
+                               MessagePartSpecification sigSpec = 
SignaturePart;
 
                                // encryption key (possibly also used for 
signing)
                                // FIXME: get correct SymmetricAlgorithm 
according to the algorithm suite

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SymmetricSecurityBindingElement.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SymmetricSecurityBindingElement.cs
       2007-01-11 07:20:53 UTC (rev 70835)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/SymmetricSecurityBindingElement.cs
       2007-01-11 07:59:44 UTC (rev 70836)
@@ -118,7 +118,7 @@
                                
context.BindingParameters.Find<ChannelProtectionRequirements> ();
 
                        return new SecurityChannelFactory<TChannel> (
-                               context.BuildInnerChannelFactory<TChannel> (), 
new SymmetricSecurityBindingSupport (this, manager, requirements));
+                               context.BuildInnerChannelFactory<TChannel> (), 
new MessageSecurityBindingSupport (this, manager, requirements));
                }
 
                [MonoTODO]
@@ -140,7 +140,7 @@
                                
context.BindingParameters.Find<ChannelProtectionRequirements> ();
 
                        return new SecurityChannelListener<TChannel> (
-                               context.BuildInnerChannelListener<TChannel> (), 
new SymmetricSecurityBindingSupport (this, manager, requirements));
+                               context.BuildInnerChannelListener<TChannel> (), 
new MessageSecurityBindingSupport (this, manager, requirements));
                }
 
                public override BindingElement Clone ()

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

Reply via email to