コード例 #1
0
 private static bool TryCreateSecurity(SecurityBindingElement sbe, UnifiedSecurityMode mode, HttpTransportSecurity transportSecurity, bool isReliableSession, out WSHttpSecurity security)
 {
     if (!WSHttpSecurity.TryCreate(sbe, mode, transportSecurity, isReliableSession, out security))
     {
         return(false);
     }
     return(SecurityElementBase.AreBindingsMatching(security.CreateMessageSecurity(isReliableSession, WS2007MessageSecurityVersion), sbe));
 }
コード例 #2
0
        internal static bool TryCreate(SecurityBindingElement sbe, NetMsmqSecurityMode mode, out NetMsmqSecurity security)
        {
            MessageSecurityOverMsmq msmq;

            security = null;
            if (!MessageSecurityOverMsmq.TryCreate(sbe, out msmq))
            {
                msmq = null;
            }
            security = new NetMsmqSecurity(mode, null, msmq);
            if (sbe != null)
            {
                return(SecurityElementBase.AreBindingsMatching(security.CreateMessageSecurity(), sbe, false));
            }
            return(true);
        }
コード例 #3
0
 internal static bool TryCreate(SecurityBindingElement sbe, out WSDualHttpSecurity security)
 {
     security = null;
     if (sbe == null)
     {
         security = new WSDualHttpSecurity(WSDualHttpSecurityMode.None, null);
     }
     else
     {
         MessageSecurityOverHttp http;
         if (!MessageSecurityOverHttp.TryCreate <MessageSecurityOverHttp>(sbe, false, true, out http))
         {
             return(false);
         }
         security = new WSDualHttpSecurity(WSDualHttpSecurityMode.Message, http);
     }
     return(SecurityElementBase.AreBindingsMatching(security.CreateMessageSecurity(), sbe));
 }
コード例 #4
0
        internal static bool TryCreate(SecurityBindingElement wsSecurity, SecurityMode mode, bool isReliableSessionEnabled, BindingElement transportSecurity, TcpTransportSecurity tcpTransportSecurity, out NetTcpSecurity security)
        {
            security = null;
            MessageSecurityOverTcp messageSecurity = null;

            if (mode == SecurityMode.Message)
            {
                if (!MessageSecurityOverTcp.TryCreate(wsSecurity, isReliableSessionEnabled, null, out messageSecurity))
                {
                    return(false);
                }
            }
            else if ((mode == SecurityMode.TransportWithMessageCredential) && !MessageSecurityOverTcp.TryCreate(wsSecurity, isReliableSessionEnabled, transportSecurity, out messageSecurity))
            {
                return(false);
            }
            security = new NetTcpSecurity(mode, tcpTransportSecurity, messageSecurity);
            return(SecurityElementBase.AreBindingsMatching(security.CreateMessageSecurity(isReliableSessionEnabled), wsSecurity, false));
        }
コード例 #5
0
        internal static bool TryCreate(SecurityBindingElement sbe, UnifiedSecurityMode mode, HttpTransportSecurity transportSecurity, out BasicHttpSecurity security)
        {
            security = null;
            BasicHttpMessageSecurity security2 = null;

            if (sbe != null)
            {
                bool flag;
                mode &= UnifiedSecurityMode.TransportWithMessageCredential | UnifiedSecurityMode.Message;
                if (!BasicHttpMessageSecurity.TryCreate(sbe, out security2, out flag))
                {
                    return(false);
                }
            }
            else
            {
                mode &= ~(UnifiedSecurityMode.TransportWithMessageCredential | UnifiedSecurityMode.Message);
            }
            BasicHttpSecurityMode mode2 = BasicHttpSecurityModeHelper.ToSecurityMode(mode);

            security = new BasicHttpSecurity(mode2, transportSecurity, security2);
            return(SecurityElementBase.AreBindingsMatching(security.CreateMessageSecurity(), sbe));
        }