Example #1
0
        internal static void Fault(this ICommunicationObject communicationObject, Exception exception)
        {
            Type type = communicationObject.GetType();

            object[] objArray = new object[] { exception };
            InvokeHelper.InvokeInstanceMethod(type, communicationObject, "Fault", objArray);
        }
Example #2
0
        private bool IsBindingElementsMatch(HttpRelayTransportBindingElement transport, MessageEncodingBindingElement encoding)
        {
            if (this.MessageEncoding == WSMessageEncoding.Text)
            {
                Type type = typeof(BindingElement);
                TextMessageEncodingBindingElement textMessageEncodingBindingElement = this.textEncoding;
                object[] objArray = new object[] { encoding };
                if (!(bool)InvokeHelper.InvokeInstanceMethod(type, textMessageEncodingBindingElement, "IsMatch", objArray))
                {
                    return(false);
                }
            }
            else if (this.MessageEncoding == WSMessageEncoding.Mtom)
            {
                Type type1 = typeof(BindingElement);
                MtomMessageEncodingBindingElement mtomMessageEncodingBindingElement = this.mtomEncoding;
                object[] objArray1 = new object[] { encoding };
                if (!(bool)InvokeHelper.InvokeInstanceMethod(type1, mtomMessageEncodingBindingElement, "IsMatch", objArray1))
                {
                    return(false);
                }
            }
            Type type2 = typeof(BindingElement);
            TransportBindingElement transportBindingElement = this.GetTransport();

            object[] objArray2 = new object[] { transport };
            if (!(bool)InvokeHelper.InvokeInstanceMethod(type2, transportBindingElement, "IsMatch", objArray2))
            {
                return(false);
            }
            return(true);
        }
Example #3
0
        private static bool IsBindingElementMatch(BindingElement elementThis, BindingElement elementThat)
        {
            Type type = elementThis.GetType();

            object[] objArray = new object[] { elementThat };
            return((bool)InvokeHelper.InvokeInstanceMethod(type, elementThis, "IsMatch", objArray));
        }
        internal static bool TryCreate(SecurityBindingElement sbe, out BasicHttpRelayMessageSecurity security, out bool isSecureTransportMode)
        {
            BasicHttpMessageCredentialType basicHttpMessageCredentialType;

            Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.DebugAssert(null != sbe, string.Empty);
            security = null;
            isSecureTransportMode = false;
            if (!(bool)InvokeHelper.InvokeInstanceGet(sbe.GetType(), sbe, "DoNotEmitTrust"))
            {
                return(false);
            }
            Type type = sbe.GetType();

            object[] objArray = new object[] { false };
            if (!(bool)InvokeHelper.InvokeInstanceMethod(type, sbe, "IsSetKeyDerivation", objArray))
            {
                return(false);
            }
            if (sbe.SecurityHeaderLayout != SecurityHeaderLayout.Lax)
            {
                return(false);
            }
            if (sbe.MessageSecurityVersion != MessageSecurityVersion.WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10)
            {
                return(false);
            }
            if (SecurityUtil.SecurityBindingElement.IsMutualCertificateBinding(sbe, true))
            {
                basicHttpMessageCredentialType = BasicHttpMessageCredentialType.Certificate;
            }
            else
            {
                isSecureTransportMode = true;
                if (!SecurityUtil.SecurityBindingElement.IsCertificateOverTransportBinding(sbe))
                {
                    if (!SecurityUtil.SecurityBindingElement.IsUserNameOverTransportBinding(sbe))
                    {
                        return(false);
                    }
                    basicHttpMessageCredentialType = BasicHttpMessageCredentialType.UserName;
                }
                else
                {
                    basicHttpMessageCredentialType = BasicHttpMessageCredentialType.Certificate;
                }
            }
            security = new BasicHttpRelayMessageSecurity()
            {
                ClientCredentialType = basicHttpMessageCredentialType,
                AlgorithmSuite       = sbe.DefaultAlgorithmSuite
            };
            return(true);
        }
        protected bool IsBindingElementsMatch(TcpRelayTransportBindingElement transport, BinaryMessageEncodingBindingElement encoding)
        {
            if (!this.transport.IsMatch(transport))
            {
                return(false);
            }
            Type type = typeof(BindingElement);
            BinaryMessageEncodingBindingElement binaryMessageEncodingBindingElement = this.encoding;

            object[] objArray = new object[] { encoding };
            if (!(bool)InvokeHelper.InvokeInstanceMethod(type, binaryMessageEncodingBindingElement, "IsMatch", objArray))
            {
                return(false);
            }
            return(true);
        }
        private bool IsBindingElementsMatch(RelayedOnewayTransportBindingElement transport, MessageEncodingBindingElement encoding)
        {
            Type type = typeof(BindingElement);
            RelayedOnewayTransportBindingElement relayedOnewayTransportBindingElement = this.GetTransport();

            object[] objArray = new object[] { transport };
            if ((bool)InvokeHelper.InvokeInstanceMethod(type, relayedOnewayTransportBindingElement, "IsMatch", objArray))
            {
                return(false);
            }
            Type type1 = typeof(BindingElement);
            BinaryMessageEncodingBindingElement binaryMessageEncodingBindingElement = this.encoding;

            object[] objArray1 = new object[] { encoding };
            if ((bool)InvokeHelper.InvokeInstanceMethod(type1, binaryMessageEncodingBindingElement, "IsMatch", objArray1))
            {
                return(false);
            }
            return(true);
        }
Example #7
0
 protected bool IsBindingElementsMatch(TcpRelayTransportBindingElement transport, BinaryMessageEncodingBindingElement encoding, ReliableSessionBindingElement session)
 {
     if (!base.IsBindingElementsMatch(transport, encoding))
     {
         return(false);
     }
     if (this.reliableSession.Enabled)
     {
         Type type = typeof(BindingElement);
         ReliableSessionBindingElement reliableSessionBindingElement = this.session;
         object[] objArray = new object[] { session };
         if (!(bool)InvokeHelper.InvokeInstanceMethod(type, reliableSessionBindingElement, "IsMatch", objArray))
         {
             return(false);
         }
     }
     else if (session != null)
     {
         return(false);
     }
     return(true);
 }
Example #8
0
 internal static void AddAlgorithmParameters(System.ServiceModel.Security.Tokens.IssuedSecurityTokenParameters that, params object[] args)
 {
     InvokeHelper.InvokeInstanceMethod(typeof(System.ServiceModel.Security.Tokens.IssuedSecurityTokenParameters), that, "AddAlgorithmParameters", args);
 }