Beispiel #1
0
        internal static bool TryCreate(SecurityBindingElement sbe, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType, UnifiedSecurityMode mode, HttpRelayTransportSecurity transportSecurity, out BasicHttpRelaySecurity security)
        {
            bool flag;

            security = null;
            BasicHttpRelayMessageSecurity basicHttpRelayMessageSecurity = null;

            if (sbe == null)
            {
                mode = mode & (UnifiedSecurityMode.None | UnifiedSecurityMode.Transport | UnifiedSecurityMode.Both);
            }
            else
            {
                mode = mode & (UnifiedSecurityMode.Message | UnifiedSecurityMode.TransportWithMessageCredential);
                if (!BasicHttpRelayMessageSecurity.TryCreate(sbe, out basicHttpRelayMessageSecurity, out flag))
                {
                    return(false);
                }
            }
            EndToEndBasicHttpSecurityMode endToEndBasicHttpSecurityMode = EndToEndBasicHttpSecurityModeHelper.ToEndToEndBasicHttpSecurityMode(mode);
            bool        flag1            = EndToEndBasicHttpSecurityModeHelper.IsDefined(endToEndBasicHttpSecurityMode);
            CultureInfo invariantCulture = CultureInfo.InvariantCulture;

            object[] str = new object[] { endToEndBasicHttpSecurityMode.ToString() };
            DiagnosticUtility.DebugAssert(flag1, string.Format(invariantCulture, "Invalid BasicHttpSecurityMode value: {0}.", str));
            security = new BasicHttpRelaySecurity(endToEndBasicHttpSecurityMode, relayClientAuthenticationType, transportSecurity, basicHttpRelayMessageSecurity);
            if (sbe == null)
            {
                return(true);
            }
            Type type = typeof(SecurityElementBase);

            object[] objArray = new object[] { security.CreateMessageSecurity(), sbe };
            return((bool)InvokeHelper.InvokeStaticMethod(type, "AreBindingsMatching", objArray));
        }
Beispiel #2
0
        private BasicHttpRelaySecurity(EndToEndBasicHttpSecurityMode mode, Microsoft.ServiceBus.RelayClientAuthenticationType relayClientAuthenticationType, HttpRelayTransportSecurity transportSecurity, BasicHttpRelayMessageSecurity messageSecurity)
        {
            bool        flag             = EndToEndBasicHttpSecurityModeHelper.IsDefined(mode);
            CultureInfo invariantCulture = CultureInfo.InvariantCulture;

            object[] str = new object[] { mode.ToString() };
            DiagnosticUtility.DebugAssert(flag, string.Format(invariantCulture, "Invalid BasicHttpSecurityMode value: {0}.", str));
            this.Mode = mode;
            this.RelayClientAuthenticationType = relayClientAuthenticationType;
            this.transportSecurity             = (transportSecurity == null ? new HttpRelayTransportSecurity() : transportSecurity);
            this.messageSecurity = (messageSecurity == null ? new BasicHttpRelayMessageSecurity() : messageSecurity);
        }