private static bool TryCreateSecurity(SecurityBindingElement sbe, RelayClientAuthenticationType relayClientAuthenticationType, Microsoft.ServiceBus.UnifiedSecurityMode mode, out NetOnewayRelaySecurity security) { if (sbe == null) { mode = mode & (Microsoft.ServiceBus.UnifiedSecurityMode.None | Microsoft.ServiceBus.UnifiedSecurityMode.Transport | Microsoft.ServiceBus.UnifiedSecurityMode.TransportWithMessageCredential); } else { mode = mode & (Microsoft.ServiceBus.UnifiedSecurityMode.Message | Microsoft.ServiceBus.UnifiedSecurityMode.Both); } EndToEndSecurityMode relaySecurityMode = EndToEndSecurityModeHelper.ToRelaySecurityMode(mode); bool flag = EndToEndSecurityModeHelper.IsDefined(relaySecurityMode); CultureInfo invariantCulture = CultureInfo.InvariantCulture; object[] str = new object[] { relaySecurityMode.ToString() }; Microsoft.ServiceBus.Diagnostics.DiagnosticUtility.DebugAssert(flag, string.Format(invariantCulture, "Invalid RelaySecurityMode value: {0}.", str)); if (NetOnewayRelaySecurity.TryCreate(sbe, relaySecurityMode, relayClientAuthenticationType, out security)) { return(true); } return(false); }
internal static bool TryCreate(SecurityBindingElement sbe, Microsoft.ServiceBus.UnifiedSecurityMode mode, HttpRelayTransportSecurity transportSecurity, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType, bool isReliableSessionEnabled, out WSHttpRelaySecurity security) { security = null; NonDualMessageSecurityOverRelayHttp nonDualMessageSecurityOverRelayHttp = null; EndToEndSecurityMode relaySecurityMode = EndToEndSecurityMode.None; if (sbe == null) { mode = mode & (Microsoft.ServiceBus.UnifiedSecurityMode.None | Microsoft.ServiceBus.UnifiedSecurityMode.Transport | Microsoft.ServiceBus.UnifiedSecurityMode.Both); relaySecurityMode = EndToEndSecurityModeHelper.ToRelaySecurityMode(mode); } else { mode = mode & (Microsoft.ServiceBus.UnifiedSecurityMode.Message | Microsoft.ServiceBus.UnifiedSecurityMode.TransportWithMessageCredential); relaySecurityMode = EndToEndSecurityModeHelper.ToRelaySecurityMode(mode); if (!MessageSecurityOverRelayHttp.TryCreate <NonDualMessageSecurityOverRelayHttp>(sbe, relaySecurityMode == EndToEndSecurityMode.TransportWithMessageCredential, isReliableSessionEnabled, out nonDualMessageSecurityOverRelayHttp)) { return(false); } } security = new WSHttpRelaySecurity(relaySecurityMode, relayClientAuthenticationType, transportSecurity, nonDualMessageSecurityOverRelayHttp); return(true); }