internal WSHttpRelaySecurity(EndToEndSecurityMode mode, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType, HttpRelayTransportSecurity transportSecurity, NonDualMessageSecurityOverRelayHttp messageSecurity)
 {
     this.mode = mode;
     this.relayClientAuthenticationType = relayClientAuthenticationType;
     this.transportSecurity             = (transportSecurity == null ? WSHttpRelaySecurity.GetDefaultHttpTransportSecurity() : transportSecurity);
     this.messageSecurity = (messageSecurity == null ? new NonDualMessageSecurityOverRelayHttp() : messageSecurity);
 }
Exemplo n.º 2
0
        internal static SecurityMode ToSecurityMode(EndToEndSecurityMode value)
        {
            switch (value)
            {
            case EndToEndSecurityMode.None:
            {
                return(SecurityMode.None);
            }

            case EndToEndSecurityMode.Transport:
            {
                return(SecurityMode.Transport);
            }

            case EndToEndSecurityMode.Message:
            {
                return(SecurityMode.Message);
            }

            case EndToEndSecurityMode.TransportWithMessageCredential:
            {
                return(SecurityMode.TransportWithMessageCredential);
            }

            default:
            {
                return(SecurityMode.None);
            }
            }
        }
Exemplo n.º 3
0
 internal static bool IsDefined(EndToEndSecurityMode value)
 {
     if (value == EndToEndSecurityMode.None || value == EndToEndSecurityMode.Transport || value == EndToEndSecurityMode.TransportWithMessageCredential)
     {
         return(true);
     }
     return(value == EndToEndSecurityMode.Message);
 }
Exemplo n.º 4
0
        private NetOnewayRelaySecurity(EndToEndSecurityMode mode, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType, RelayedOnewayTransportSecurity transportSecurity, MessageSecurityOverRelayOneway messageSecurity)
        {
            bool        flag             = EndToEndSecurityModeHelper.IsDefined(mode);
            CultureInfo invariantCulture = CultureInfo.InvariantCulture;

            object[] str = new object[] { mode.ToString() };
            DiagnosticUtility.DebugAssert(flag, string.Format(invariantCulture, "Invalid RelaySecurityMode value: {0}.", str));
            this.mode = mode;
            this.relayClientAuthenticationType = relayClientAuthenticationType;
            this.transportSecurity             = (transportSecurity == null ? new RelayedOnewayTransportSecurity() : transportSecurity);
            this.messageSecurity = (messageSecurity == null ? new MessageSecurityOverRelayOneway() : messageSecurity);
        }
Exemplo n.º 5
0
 internal static bool IsConfiguredTransportSecurity(NetOnewayRelayBindingElement oneway, out UnifiedSecurityMode mode)
 {
     if (oneway == null)
     {
         mode = UnifiedSecurityMode.None;
         return(false);
     }
     if (oneway.Security.Mode == EndToEndSecurityMode.Transport || oneway.Security.Mode == EndToEndSecurityMode.TransportWithMessageCredential)
     {
         mode = UnifiedSecurityMode.Transport | UnifiedSecurityMode.TransportWithMessageCredential;
     }
     else
     {
         mode = UnifiedSecurityMode.None | UnifiedSecurityMode.Message;
     }
     return(true);
 }
Exemplo n.º 6
0
        internal static bool TryCreate(SecurityBindingElement wsSecurity, EndToEndSecurityMode mode, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType, bool isReliableSessionEnabled, TcpRelayTransportSecurity tcpTransportSecurity, out NetTcpRelaySecurity security)
        {
            security = null;
            MessageSecurityOverRelayConnection messageSecurityOverRelayConnection = null;

            if ((mode == EndToEndSecurityMode.Message || mode == EndToEndSecurityMode.TransportWithMessageCredential) && !MessageSecurityOverRelayConnection.TryCreate(wsSecurity, isReliableSessionEnabled, out messageSecurityOverRelayConnection))
            {
                return(false);
            }
            security = new NetTcpRelaySecurity(mode, relayClientAuthenticationType, tcpTransportSecurity, messageSecurityOverRelayConnection);
            if (wsSecurity == null)
            {
                return(true);
            }
            Type type = typeof(SecurityElementBase);

            object[] objArray = new object[] { security.CreateMessageSecurity(isReliableSessionEnabled, wsSecurity.MessageSecurityVersion), wsSecurity, false };
            return((bool)InvokeHelper.InvokeStaticMethod(type, "AreBindingsMatching", objArray));
        }
Exemplo n.º 7
0
        internal static bool TryCreate(SecurityBindingElement sbe, EndToEndSecurityMode mode, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType, out NetOnewayRelaySecurity security)
        {
            MessageSecurityOverRelayOneway messageSecurityOverRelayOneway;

            security = null;
            if (!MessageSecurityOverRelayOneway.TryCreate(sbe, out messageSecurityOverRelayOneway))
            {
                messageSecurityOverRelayOneway = null;
            }
            security = new NetOnewayRelaySecurity(mode, relayClientAuthenticationType, null, messageSecurityOverRelayOneway);
            if (sbe == null)
            {
                return(true);
            }
            Type type = typeof(SecurityElementBase);

            object[] objArray = new object[] { security.CreateMessageSecurity(), sbe, false };
            return((bool)InvokeHelper.InvokeStaticMethod(type, "AreBindingsMatching", objArray));
        }
        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);
        }
 public WS2007HttpRelayBinding(EndToEndSecurityMode securityMode, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType, bool reliableSessionEnabled) : base(securityMode, relayClientAuthenticationType, reliableSessionEnabled)
 {
     base.ReliableSessionBindingElement.ReliableMessagingVersion = WS2007HttpRelayBinding.WS2007ReliableMessagingVersion;
     base.HttpsTransport.MessageSecurityVersion = WS2007HttpRelayBinding.WS2007MessageSecurityVersion;
 }
Exemplo n.º 11
0
 internal NetOnewayRelaySecurity(EndToEndSecurityMode mode, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType) : this(mode, relayClientAuthenticationType, null, null)
 {
 }
Exemplo n.º 12
0
 public NetTcpRelayBinding(EndToEndSecurityMode securityMode, RelayClientAuthenticationType relayClientAuthenticationType, bool reliableSessionEnabled) : this(securityMode, relayClientAuthenticationType)
 {
     this.ReliableSession.Enabled = reliableSessionEnabled;
 }
Exemplo n.º 13
0
 public NetEventRelayBinding(EndToEndSecurityMode securityMode, RelayEventSubscriberAuthenticationType relayClientAuthenticationType) : base(RelayedOnewayConnectionMode.Multicast, securityMode, (RelayClientAuthenticationType)relayClientAuthenticationType)
 {
 }
 protected NetTcpRelayBindingBase(EndToEndSecurityMode securityMode, RelayClientAuthenticationType relayClientAuthenticationType) : this()
 {
     this.security.Mode = securityMode;
     this.security.RelayClientAuthenticationType = relayClientAuthenticationType;
 }
 public NetOnewayRelayBinding(EndToEndSecurityMode securityMode, RelayClientAuthenticationType relayClientAuthenticationType) : this()
 {
     this.security.RelayClientAuthenticationType = relayClientAuthenticationType;
     this.security.Mode = securityMode;
 }
 protected NetOnewayRelayBinding(RelayedOnewayConnectionMode connectionMode, EndToEndSecurityMode securityMode, RelayClientAuthenticationType relayClientAuthenticationType) : this(securityMode, relayClientAuthenticationType)
 {
     this.transport.ConnectionMode = connectionMode;
 }
Exemplo n.º 17
0
 public NetTcpRelayBinding(EndToEndSecurityMode securityMode, RelayClientAuthenticationType relayClientAuthenticationType) : base(securityMode, relayClientAuthenticationType)
 {
     this.Initialize();
 }
 public WS2007HttpRelayBinding(EndToEndSecurityMode securityMode, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType) : this(securityMode, relayClientAuthenticationType, false)
 {
 }
Exemplo n.º 19
0
 internal WSHttpRelayBinding(EndToEndSecurityMode securityMode, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType, bool reliableSessionEnabled) : base(reliableSessionEnabled)
 {
     this.security.Mode = securityMode;
     this.security.RelayClientAuthenticationType = relayClientAuthenticationType;
 }