Example #1
0
        public void ValidateDoesNotThrow()
        {
            var wha = new WcfWebHttpAdapter.Outbound(
                a => {
                a.Address = new EndpointAddress("https://localhost/dummy.svc");

                a.Identity                      = EndpointIdentityFactory.CreateSpnIdentity("spn_name");
                a.SecurityMode                  = WebHttpSecurityMode.Transport;
                a.ServiceCertificate            = "thumbprint";
                a.TransportClientCredentialType = HttpClientCredentialType.Basic;
                a.UserName                      = "******";
                a.Password                      = "******";

                a.UseAcsAuthentication = true;
                a.StsUri       = new Uri("https://localhost/swt_token_issuer");
                a.IssuerName   = "issuer_name";
                a.IssuerSecret = "secret";

                a.SuppressMessageBodyForHttpVerbs = "GET";
                a.HttpHeaders    = "Content-Type: application/json";
                a.HttpUrlMapping = new HttpUrlMapping {
                    new HttpUrlMappingOperation("AddCustomer", "POST", "/Customer/{id}"),
                    new HttpUrlMappingOperation("DeleteCustomer", "DELETE", "/Customer/{id}")
                };
                a.VariableMapping = new VariableMapping {
                    new VariablePropertyMapping("id", BizTalkFactoryProperties.ReceiverName)
                };

                a.MaxReceivedMessageSize = 2048;
            });

            Assert.That(() => ((ISupportValidation)wha).Validate(), Throws.Nothing);
        }
Example #2
0
        public void ValidateDoesNotThrow()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var wha = new WcfWebHttpAdapter.Inbound(
                a => {
                a.Address = new("/dummy.svc", UriKind.Relative);

                a.Identity                      = EndpointIdentityFactory.CreateSpnIdentity("spn_name");
                a.SecurityMode                  = WebHttpSecurityMode.Transport;
                a.ServiceCertificate            = "thumbprint";
                a.TransportClientCredentialType = HttpClientCredentialType.Windows;

                a.AddMessageBodyForHttpVerbs = "GET,HEAD";
                a.HttpHeaders    = "Content-Type: application/json\r\nReferer: http://www.my.org/";
                a.HttpUrlMapping = new HttpUrlMapping {
                    new("AddCustomer", "POST", "/Customer/{id}"),
                    new("DeleteCustomer", "DELETE", "/Customer/{id}")
                };
                a.VariableMapping = new VariableMapping {
                    new("id", BizTalkFactoryProperties.MapTypeName)
                };

                a.MaxConcurrentCalls = 400;
            });

            Invoking(() => ((ISupportValidation)wha).Validate()).Should().NotThrow();
        }
        public void ValidateDoesNotThrow()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var wnt = new WcfNetTcpRelayAdapter.Outbound(
                a => {
                a.Address  = new("sb://biztalk.factory.servicebus.windows.net/batch-queue");
                a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name");

                a.MaxReceivedMessageSize = 64512;

                a.SecurityMode                = EndToEndSecurityMode.TransportWithMessageCredential;
                a.TransportProtectionLevel    = ProtectionLevel.Sign;
                a.MessageClientCredentialType = MessageCredentialType.Certificate;
                a.AlgorithmSuite              = SecurityAlgorithmSuiteValue.TripleDesSha256Rsa15;
                a.ClientCertificate           = "thumbprint";

                a.PropagateFaultMessage = true;

                a.UseAcsAuthentication = true;
                a.StsUri       = new("https://biztalk.factory-sb.accesscontrol.windows.net/");
                a.IssuerName   = "issuer_name";
                a.IssuerSecret = "issuer_secret";
            });

            Invoking(() => ((ISupportValidation)wnt).Validate()).Should().NotThrow();
        }
        public void ValidateCustomBasicHttpBindingWithTransportSecurity()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var wca = new WcfCustomAdapter.Outbound <BasicHttpBindingElement>(
                a => {
                a.Address = new("https://services.stateless.be/soap/default");
                a.Binding.Security.Mode = BasicHttpSecurityMode.Transport;
                a.Binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate;
                a.EndpointBehaviors = new[] {
                    new ClientCredentialsElement {
                        ClientCertificate =
                        {
                            FindValue     = "*.stateless.be",
                            StoreLocation = StoreLocation.LocalMachine,
                            StoreName     = StoreName.My,
                            X509FindType  = X509FindType.FindBySubjectName
                        }
                    }
                };
                a.Identity = EndpointIdentityFactory.CreateCertificateIdentity(
                    StoreLocation.LocalMachine,
                    StoreName.TrustedPeople,
                    X509FindType.FindBySubjectDistinguishedName,
                    "*.services.party.be");
            });

            Invoking(() => ((ISupportValidation)wca).Validate()).Should().NotThrow();
        }
Example #5
0
        protected LightClient(
            string endpointConfigurationName,
            string remoteAddress,
            string messagingPattern = null)
        {
            if (endpointConfigurationName.IsNullOrWhiteSpace() && remoteAddress.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("At least one of the parameters must be not null, not empty and not consist of whitespace characters only.");
            }

            EnsureMessagingPattern(ref messagingPattern);
            if (!endpointConfigurationName.IsNullOrWhiteSpace())
            {
                ChannelFactory = !remoteAddress.IsNullOrWhiteSpace()
                                        ? new ChannelFactory <TContract>(endpointConfigurationName, new EndpointAddress(remoteAddress))
                                        : new ChannelFactory <TContract>(endpointConfigurationName);
                ConfigureBinding(ChannelFactory.Endpoint.Binding, messagingPattern);
                ConfigureChannelFactory(messagingPattern);
            }
            else
            {
                Debug.Assert(!remoteAddress.IsNullOrWhiteSpace());

                BuildChannelFactory(remoteAddress, messagingPattern, EndpointIdentityFactory.CreateEndpointIdentity(ServiceIdentity.None, ""));
            }
        }
        public void SerializeToXml()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var wba = new WcfBasicHttpRelayAdapter.Inbound(
                a => {
                a.Address                        = new("https://biztalk.factory.servicebus.windows.net/batch-queue");
                a.Identity                       = EndpointIdentityFactory.CreateSpnIdentity("spn_name");
                a.MaxConcurrentCalls             = 201;
                a.MaxReceivedMessageSize         = 64512;
                a.MessageEncoding                = WSMessageEncoding.Mtom;
                a.SuspendRequestMessageOnFailure = true;
                a.IncludeExceptionDetailInFaults = true;

                a.UseAcsAuthentication = true;
                a.StsUri       = new("https://biztalk.factory-sb.accesscontrol.windows.net/");
                a.IssuerName   = "issuer_name";
                a.IssuerSecret = "issuer_secret";

                a.EnableServiceDiscovery = true;
                a.ServiceDisplayName     = "display_name";
            });
            var xml = wba.GetAdapterBindingInfoSerializer().Serialize();

            xml.Should().Be(
                "<CustomProps>" +
                "<MaxReceivedMessageSize vt=\"3\">64512</MaxReceivedMessageSize>" +
                "<MessageEncoding vt=\"8\">Mtom</MessageEncoding>" +
                "<TextEncoding vt=\"8\">utf-8</TextEncoding>" +
                "<SecurityMode vt=\"8\">Transport</SecurityMode>" +
                "<MessageClientCredentialType vt=\"8\">UserName</MessageClientCredentialType>" +
                "<AlgorithmSuite vt=\"8\">Basic256</AlgorithmSuite>" +
                "<RelayClientAuthenticationType vt=\"8\">RelayAccessToken</RelayClientAuthenticationType>" +
                "<UseSSO vt=\"11\">0</UseSSO>" +
                "<MaxConcurrentCalls vt=\"3\">201</MaxConcurrentCalls>" +
                "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" +
                "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                "<OutboundXmlTemplate vt=\"8\">" + (
                    "&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;") +
                "</OutboundXmlTemplate>" +
                "<SuspendMessageOnFailure vt=\"11\">-1</SuspendMessageOnFailure>" +
                "<IncludeExceptionDetailInFaults vt=\"11\">-1</IncludeExceptionDetailInFaults>" +
                "<StsUri vt=\"8\">https://biztalk.factory-sb.accesscontrol.windows.net/</StsUri>" +
                "<IssuerName vt=\"8\">issuer_name</IssuerName>" +
                "<IssuerSecret vt=\"8\">issuer_secret</IssuerSecret>" +
                "<UseAcsAuthentication vt=\"11\">-1</UseAcsAuthentication>" +
                "<UseSasAuthentication vt=\"11\">0</UseSasAuthentication>" +
                "<EnableServiceDiscovery vt=\"11\">-1</EnableServiceDiscovery>" +
                "<DiscoveryMode vt=\"8\">Public</DiscoveryMode>" +
                "<ServiceDisplayName vt=\"8\">display_name</ServiceDisplayName>" +
                "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" +
                "<SendTimeout vt=\"8\">00:01:00</SendTimeout>" +
                "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" +
                "<Identity vt=\"8\">" + (
                    "&lt;identity&gt;\r\n  &lt;servicePrincipalName value=\"spn_name\" /&gt;\r\n&lt;/identity&gt;") +
                "</Identity>" +
                "</CustomProps>")
            ;
        }
Example #7
0
 protected MessagingPatternServiceHostFactory(
     ServiceIdentity identityType,
     X509Certificate2 certificate,
     string messagingPattern)
     : this(messagingPattern)
 {
     EndpointIdentity = EndpointIdentityFactory.CreateEndpointIdentity(identityType, certificate);
 }
Example #8
0
 protected MessagingPatternServiceHostFactory(
     ServiceIdentity identityType,
     string identity         = null,
     string messagingPattern = null)
     : this(messagingPattern)
 {
     EndpointIdentity = EndpointIdentityFactory.CreateEndpointIdentity(identityType, identity);
 }
        public void SerializeToXml()
        {
            var wnt = new WcfNetTcpRelayAdapter.Inbound(
                a => {
                a.Address                = new EndpointAddress("sb://biztalk.factory.servicebus.windows.net/batch-queue");
                a.Identity               = EndpointIdentityFactory.CreateSpnIdentity("spn_name");
                a.MaxConcurrentCalls     = 201;
                a.MaxReceivedMessageSize = 64512;

                a.SuspendRequestMessageOnFailure = true;
                a.IncludeExceptionDetailInFaults = true;

                a.StsUri       = new Uri("https://biztalk.factory-sb.accesscontrol.windows.net/");
                a.IssuerName   = "issuer_name";
                a.IssuerSecret = "issuer_secret";

                a.EnableServiceDiscovery = true;
                a.ServiceDisplayName     = "display_name";
            });
            var xml = ((IAdapterBindingSerializerFactory)wnt).GetAdapterBindingSerializer().Serialize();

            Assert.That(
                xml,
                Is.EqualTo(
                    "<CustomProps>" +
                    "<MaxReceivedMessageSize vt=\"3\">64512</MaxReceivedMessageSize>" +
                    "<SecurityMode vt=\"8\">Transport</SecurityMode>" +
                    "<MessageClientCredentialType vt=\"8\">Windows</MessageClientCredentialType>" +
                    "<AlgorithmSuite vt=\"8\">Basic256</AlgorithmSuite>" +
                    "<TransportProtectionLevel vt=\"8\">EncryptAndSign</TransportProtectionLevel>" +
                    "<RelayClientAuthenticationType vt=\"8\">RelayAccessToken</RelayClientAuthenticationType>" +
                    "<LeaseTimeout vt=\"8\">00:00:00</LeaseTimeout>" +
                    "<UseSSO vt=\"11\">0</UseSSO>" +
                    "<MaxConcurrentCalls vt=\"3\">201</MaxConcurrentCalls>" +
                    "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" +
                    "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                    "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                    "<OutboundXmlTemplate vt=\"8\">" + (
                        "&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;") +
                    "</OutboundXmlTemplate>" +
                    "<SuspendMessageOnFailure vt=\"11\">-1</SuspendMessageOnFailure>" +
                    "<IncludeExceptionDetailInFaults vt=\"11\">-1</IncludeExceptionDetailInFaults>" +
                    "<StsUri vt=\"8\">https://biztalk.factory-sb.accesscontrol.windows.net/</StsUri>" +
                    "<IssuerName vt=\"8\">issuer_name</IssuerName>" +
                    "<IssuerSecret vt=\"8\">issuer_secret</IssuerSecret>" +
                    "<EnableServiceDiscovery vt=\"11\">-1</EnableServiceDiscovery>" +
                    "<DiscoveryMode vt=\"8\">Public</DiscoveryMode>" +
                    "<ServiceDisplayName vt=\"8\">display_name</ServiceDisplayName>" +
                    "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" +
                    "<SendTimeout vt=\"8\">00:01:00</SendTimeout>" +
                    "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" +
                    "<Identity vt=\"8\">" + (
                        "&lt;identity&gt;\r\n  &lt;servicePrincipalName value=\"spn_name\" /&gt;\r\n&lt;/identity&gt;") +
                    "</Identity>" +
                    "</CustomProps>"))
            ;
        }
Example #10
0
 protected MessagingPatternServiceHostFactory(
     Claim identityClaim,
     string messagingPattern)
     : this(messagingPattern)
 {
     if (identityClaim != null)
     {
         EndpointIdentity = EndpointIdentityFactory.CreateEndpointIdentity(identityClaim);
     }
 }
Example #11
0
        public void ValidateDoesNotThrow()
        {
            var wha = new WcfWSHttpAdapter.Outbound(
                a => {
                a.Address      = new EndpointAddress("http://localhost/dummy.svc");
                a.Identity     = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.SecurityMode = SecurityMode.Message;
                a.TextEncoding = Encoding.Unicode;
            });

            Assert.That(() => ((ISupportValidation)wha).Validate(), Throws.Nothing);
        }
        public void SerializeToXml()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var wnt = new WcfNetTcpRelayAdapter.Outbound(
                a => {
                a.Address  = new("sb://biztalk.factory.servicebus.windows.net/batch-queue");
                a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name");
                a.MaxReceivedMessageSize      = 64512;
                a.SecurityMode                = EndToEndSecurityMode.TransportWithMessageCredential;
                a.SendTimeout                 = TimeSpan.FromMinutes(2);
                a.TransportProtectionLevel    = ProtectionLevel.Sign;
                a.MessageClientCredentialType = MessageCredentialType.Certificate;
                a.AlgorithmSuite              = SecurityAlgorithmSuiteValue.TripleDesSha256Rsa15;
                a.ClientCertificate           = "thumbprint";
                a.PropagateFaultMessage       = true;
                a.UseAcsAuthentication        = true;
                a.StsUri       = new("https://biztalk.factory-sb.accesscontrol.windows.net/");
                a.IssuerName   = "issuer_name";
                a.IssuerSecret = "issuer_secret";
            });
            var xml = wnt.GetAdapterBindingInfoSerializer().Serialize();

            xml.Should().Be(
                "<CustomProps>" +
                "<MaxReceivedMessageSize vt=\"3\">64512</MaxReceivedMessageSize>" +
                "<UseSSO vt=\"11\">0</UseSSO>" +
                "<SecurityMode vt=\"8\">TransportWithMessageCredential</SecurityMode>" +
                "<MessageClientCredentialType vt=\"8\">Certificate</MessageClientCredentialType>" +
                "<AlgorithmSuite vt=\"8\">TripleDesSha256Rsa15</AlgorithmSuite>" +
                "<TransportProtectionLevel vt=\"8\">Sign</TransportProtectionLevel>" +
                "<ClientCertificate vt=\"8\">thumbprint</ClientCertificate>" +
                "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" +
                "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                "<OutboundXmlTemplate vt=\"8\">" + (
                    "&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;") +
                "</OutboundXmlTemplate>" +
                "<PropagateFaultMessage vt=\"11\">-1</PropagateFaultMessage>" +
                "<StsUri vt=\"8\">https://biztalk.factory-sb.accesscontrol.windows.net/</StsUri>" +
                "<IssuerName vt=\"8\">issuer_name</IssuerName>" +
                "<IssuerSecret vt=\"8\">issuer_secret</IssuerSecret>" +
                "<UseAcsAuthentication vt=\"11\">-1</UseAcsAuthentication>" +
                "<UseSasAuthentication vt=\"11\">0</UseSasAuthentication>" +
                "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" +
                "<SendTimeout vt=\"8\">00:02:00</SendTimeout>" +
                "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" +
                "<Identity vt=\"8\">" + (
                    "&lt;identity&gt;\r\n  &lt;servicePrincipalName value=\"spn_name\" /&gt;\r\n&lt;/identity&gt;") +
                "</Identity>" +
                "</CustomProps>")
            ;
        }
Example #13
0
        public void ValidateDoesNotThrow()
        {
            var nta = new WcfNetTcpAdapter.Outbound(
                a => {
                a.Address      = new EndpointAddress("net.tcp://localhost/biztalk.factory/service.svc");
                a.Identity     = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.SecurityMode = SecurityMode.Message;
                a.MessageClientCredentialType = MessageCredentialType.Windows;
            });

            Assert.That(() => ((ISupportValidation)nta).Validate(), Throws.Nothing);
        }
Example #14
0
        public void SerializeToXml()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var nma = new WcfNetMsmqAdapter.Outbound(
                a => {
                a.Address  = new("net.msmq://localhost/private/service_queue");
                a.Identity = EndpointIdentityFactory.CreateCertificateIdentity(
                    StoreLocation.LocalMachine,
                    StoreName.TrustedPeople,
                    X509FindType.FindBySubjectName,
                    "subject-name");
                a.SecurityMode          = NetMsmqSecurityMode.Message;
                a.SendTimeout           = TimeSpan.FromMinutes(2);
                a.UseSourceJournal      = true;
                a.DeadLetterQueue       = DeadLetterQueue.Custom;
                a.CustomDeadLetterQueue = "net.msmq://localhost/deadLetterQueueName";
                a.StaticAction          = "http://biztalk.stateless.be/action";
            });
            var xml = nma.GetAdapterBindingInfoSerializer().Serialize();

            xml.Should().Be(
                "<CustomProps>" +
                "<TimeToLive vt=\"8\">1.00:00:00</TimeToLive>" +
                "<UseSourceJournal vt=\"11\">-1</UseSourceJournal>" +
                "<DeadLetterQueue vt=\"8\">Custom</DeadLetterQueue>" +
                "<CustomDeadLetterQueue vt=\"8\">net.msmq://localhost/deadLetterQueueName</CustomDeadLetterQueue>" +
                "<EnableTransaction vt=\"11\">-1</EnableTransaction>" +
                "<SecurityMode vt=\"8\">Message</SecurityMode>" +
                "<MessageClientCredentialType vt=\"8\">Windows</MessageClientCredentialType>" +
                "<AlgorithmSuite vt=\"8\">Basic256</AlgorithmSuite>" +
                "<MsmqAuthenticationMode vt=\"8\">WindowsDomain</MsmqAuthenticationMode>" +
                "<MsmqProtectionLevel vt=\"8\">Sign</MsmqProtectionLevel>" +
                "<MsmqSecureHashAlgorithm vt=\"8\">Sha1</MsmqSecureHashAlgorithm>" +
                "<MsmqEncryptionAlgorithm vt=\"8\">RC4Stream</MsmqEncryptionAlgorithm>" +
                "<UseSSO vt=\"11\">0</UseSSO>" +
                "<StaticAction vt=\"8\">http://biztalk.stateless.be/action</StaticAction>" +
                "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                "<OutboundXmlTemplate vt=\"8\">&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;</OutboundXmlTemplate>" +
                "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" +
                "<SendTimeout vt=\"8\">00:02:00</SendTimeout>" +
                "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" +
                "<Identity vt=\"8\">" + (
                    "&lt;identity&gt;\r\n  " +
                    "&lt;certificateReference storeName=\"TrustedPeople\" " +
                    "storeLocation=\"LocalMachine\" " +
                    "x509FindType=\"FindBySubjectName\" " +
                    "findValue=\"subject-name\" " +
                    "isChainIncluded=\"False\" /&gt;\r\n" +
                    "&lt;/identity&gt;") +
                "</Identity>" +
                "</CustomProps>");
        }
Example #15
0
        protected LightClient(
            string remoteAddress,
            Claim identityClaim,
            string messagingPattern = null)
        {
            if (remoteAddress.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("The argument cannot be null, empty string or consist of whitespace characters only.", nameof(remoteAddress));
            }

            EnsureMessagingPattern(ref messagingPattern);
            BuildChannelFactory(remoteAddress, messagingPattern, EndpointIdentityFactory.CreateEndpointIdentity(identityClaim));
        }
Example #16
0
        public void ValidateDoesNotThrow()
        {
            var bha = new WcfBasicHttpAdapter.Outbound(
                a => {
                a.Address  = new EndpointAddress("http://localhost/biztalk.factory/service.svc");
                a.Identity = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.MessageClientCredentialType = BasicHttpMessageCredentialType.Certificate;
                a.SecurityMode = BasicHttpSecurityMode.Message;
                a.TextEncoding = Encoding.Unicode;
            });

            Assert.That(() => ((ISupportValidation)bha).Validate(), Throws.Nothing);
        }
        public void ValidateDoesNotThrow()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var wha = new WcfWSHttpAdapter.Outbound(
                a => {
                a.Address      = new("http://localhost/dummy.svc");
                a.Identity     = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.SecurityMode = SecurityMode.Message;
                a.TextEncoding = Encoding.Unicode;
            });

            Invoking(() => ((ISupportValidation)wha).Validate()).Should().NotThrow();
        }
Example #18
0
        public void ValidateDoesNotThrow()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var nta = new WcfNetTcpAdapter.Inbound(
                a => {
                a.Address      = new("net.tcp://localhost/biztalk.factory/service.svc");
                a.Identity     = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.SecurityMode = SecurityMode.Message;
                a.MessageClientCredentialType = MessageCredentialType.Windows;
            });

            Invoking(() => ((ISupportValidation)nta).Validate()).Should().NotThrow();
        }
Example #19
0
        protected LightClient(
            string remoteAddress,
            ServiceIdentity identityType = ServiceIdentity.None,
            string identityName          = null,
            string messagingPattern      = null)
        {
            if (remoteAddress.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("The argument cannot be null, empty string or consist of whitespace characters only.", nameof(remoteAddress));
            }
            EndpointIdentityFactory.ValidateIdentityParameters(identityType, identityName);

            EnsureMessagingPattern(ref messagingPattern);
            BuildChannelFactory(remoteAddress, messagingPattern, EndpointIdentityFactory.CreateEndpointIdentity(identityType, identityName));
        }
        public void ValidateDoesNotThrow()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var bha = new WcfBasicHttpAdapter.Inbound(
                a => {
                a.Address  = new("/biztalk.factory/service.svc", UriKind.Relative);
                a.Identity = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.MessageClientCredentialType = BasicHttpMessageCredentialType.Certificate;
                a.SecurityMode = BasicHttpSecurityMode.Message;
                a.TextEncoding = Encoding.Unicode;
            });

            Invoking(() => ((ISupportValidation)bha).Validate()).Should().NotThrow();
        }
Example #21
0
        public void SerializeToXml()
        {
            var wba = new WcfBasicHttpRelayAdapter.Outbound(
                a => {
                a.Address  = new EndpointAddress("https://biztalk.factory.servicebus.windows.net/batch-queue");
                a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name");
                a.MaxReceivedMessageSize = 64512;
                a.MessageEncoding        = WSMessageEncoding.Mtom;
                a.SendTimeout            = TimeSpan.FromMinutes(2);
                a.StsUri       = new Uri("https://biztalk.factory-sb.accesscontrol.windows.net/");
                a.IssuerName   = "issuer_name";
                a.IssuerSecret = "issuer_secret";
            });
            var xml = ((IAdapterBindingSerializerFactory)wba).GetAdapterBindingSerializer().Serialize();

            Assert.That(
                xml,
                Is.EqualTo(
                    "<CustomProps>" +
                    "<MaxReceivedMessageSize vt=\"3\">64512</MaxReceivedMessageSize>" +
                    "<MessageEncoding vt=\"8\">Mtom</MessageEncoding>" +
                    "<TextEncoding vt=\"8\">utf-8</TextEncoding>" +
                    "<SecurityMode vt=\"8\">Transport</SecurityMode>" +
                    "<MessageClientCredentialType vt=\"8\">UserName</MessageClientCredentialType>" +
                    "<AlgorithmSuite vt=\"8\">Basic256</AlgorithmSuite>" +
                    "<UseSSO vt=\"11\">0</UseSSO>" +
                    "<ProxyToUse vt=\"8\">Default</ProxyToUse>" +
                    "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" +
                    "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                    "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                    "<OutboundXmlTemplate vt=\"8\">" + (
                        "&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;") +
                    "</OutboundXmlTemplate>" +
                    "<PropagateFaultMessage vt=\"11\">-1</PropagateFaultMessage>" +
                    "<StsUri vt=\"8\">https://biztalk.factory-sb.accesscontrol.windows.net/</StsUri>" +
                    "<IssuerName vt=\"8\">issuer_name</IssuerName>" +
                    "<IssuerSecret vt=\"8\">issuer_secret</IssuerSecret>" +
                    "<UseAcsAuthentication vt=\"11\">-1</UseAcsAuthentication>" +
                    "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" +
                    "<SendTimeout vt=\"8\">00:02:00</SendTimeout>" +
                    "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" +
                    "<Identity vt=\"8\">" + (
                        "&lt;identity&gt;\r\n  &lt;servicePrincipalName value=\"spn_name\" /&gt;\r\n&lt;/identity&gt;") +
                    "</Identity>" +
                    "</CustomProps>"))
            ;
        }
Example #22
0
        public void ValidateDoesNotThrow()
        {
            var wba = new WcfBasicHttpRelayAdapter.Outbound(
                a => {
                a.Address  = new EndpointAddress("https://biztalk.factory.servicebus.windows.net/batch-queue");
                a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name");

                a.MaxReceivedMessageSize = 64512;
                a.MessageEncoding        = WSMessageEncoding.Mtom;

                a.StsUri       = new Uri("https://biztalk.factory-sb.accesscontrol.windows.net/");
                a.IssuerName   = "issuer_name";
                a.IssuerSecret = "issuer_secret";
            });

            Assert.That(() => ((ISupportValidation)wba).Validate(), Throws.Nothing);
        }
Example #23
0
        public void ValidateDoesNotThrow()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var wba = new WcfBasicHttpRelayAdapter.Outbound(
                a => {
                a.Address  = new("https://biztalk.factory.servicebus.windows.net/batch-queue");
                a.Identity = EndpointIdentityFactory.CreateSpnIdentity("spn_name");

                a.MaxReceivedMessageSize = 64512;
                a.MessageEncoding        = WSMessageEncoding.Mtom;

                a.StsUri       = new("https://biztalk.factory-sb.accesscontrol.windows.net/");
                a.IssuerName   = "issuer_name";
                a.IssuerSecret = "issuer_secret";
            });

            Invoking(() => ((ISupportValidation)wba).Validate()).Should().NotThrow();
        }
Example #24
0
        protected LightClient(
            Binding binding,
            string remoteAddress,
            ServiceIdentity identityType,
            X509Certificate2 certificate,
            string messagingPattern = null)
        {
            if (binding == null)
            {
                throw new ArgumentNullException(nameof(binding));
            }
            if (remoteAddress.IsNullOrWhiteSpace())
            {
                throw new ArgumentException("The argument cannot be null, empty string or consist of whitespace characters only.", nameof(remoteAddress));
            }
            EndpointIdentityFactory.ValidateIdentityParameters(identityType, certificate);

            EnsureMessagingPattern(ref messagingPattern);
            BuildChannelFactory(binding, remoteAddress, messagingPattern, EndpointIdentityFactory.CreateEndpointIdentity(identityType, certificate));
        }
        public void SerializeToXml()
        {
            var wha = new WcfWSHttpAdapter.Inbound(
                a => {
                a.Address      = new Uri("/dummy.svc", UriKind.Relative);
                a.Identity     = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.SecurityMode = SecurityMode.Message;
                a.TextEncoding = Encoding.Unicode;
            });
            var xml = ((IAdapterBindingSerializerFactory)wha).GetAdapterBindingSerializer().Serialize();

            Assert.That(
                xml,
                Is.EqualTo(
                    "<CustomProps>" +
                    "<MaxReceivedMessageSize vt=\"3\">65535</MaxReceivedMessageSize>" +
                    "<MessageEncoding vt=\"8\">Text</MessageEncoding>" +
                    "<TextEncoding vt=\"8\">utf-16</TextEncoding>" +
                    "<EnableTransaction vt=\"11\">0</EnableTransaction>" +
                    "<SecurityMode vt=\"8\">Message</SecurityMode>" +
                    "<MessageClientCredentialType vt=\"8\">Windows</MessageClientCredentialType>" +
                    "<AlgorithmSuite vt=\"8\">Basic256</AlgorithmSuite>" +
                    "<NegotiateServiceCredential vt=\"11\">-1</NegotiateServiceCredential>" +
                    "<EstablishSecurityContext vt=\"11\">-1</EstablishSecurityContext>" +
                    "<TransportClientCredentialType vt=\"8\">Windows</TransportClientCredentialType>" +
                    "<UseSSO vt=\"11\">0</UseSSO>" +
                    "<MaxConcurrentCalls vt=\"3\">200</MaxConcurrentCalls>" +
                    "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" +
                    "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                    "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                    "<OutboundXmlTemplate vt=\"8\">&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;</OutboundXmlTemplate>" +
                    "<SuspendMessageOnFailure vt=\"11\">-1</SuspendMessageOnFailure>" +
                    "<IncludeExceptionDetailInFaults vt=\"11\">-1</IncludeExceptionDetailInFaults>" +
                    "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" +
                    "<SendTimeout vt=\"8\">00:01:00</SendTimeout>" +
                    "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" +
                    "<Identity vt=\"8\">&lt;identity&gt;\r\n  &lt;servicePrincipalName value=\"service_spn\" /&gt;\r\n&lt;/identity&gt;</Identity>" +
                    "</CustomProps>"));
        }
        public void ValidateDoesNotThrow()
        {
            var wba = new WcfBasicHttpRelayAdapter.Inbound(
                a => {
                a.Address                        = new EndpointAddress("https://biztalk.factory.servicebus.windows.net/batch-queue");
                a.Identity                       = EndpointIdentityFactory.CreateSpnIdentity("spn_name");
                a.MaxConcurrentCalls             = 201;
                a.MaxReceivedMessageSize         = 64512;
                a.MessageEncoding                = WSMessageEncoding.Mtom;
                a.SuspendRequestMessageOnFailure = true;
                a.IncludeExceptionDetailInFaults = true;

                a.StsUri       = new Uri("https://biztalk.factory-sb.accesscontrol.windows.net/");
                a.IssuerName   = "issuer_name";
                a.IssuerSecret = "issuer_secret";

                a.EnableServiceDiscovery = true;
                a.ServiceDisplayName     = "display_name";
            });

            Assert.That(() => ((ISupportValidation)wba).Validate(), Throws.Nothing);
        }
Example #27
0
        public void SerializeToXml()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var nta = new WcfNetTcpAdapter.Inbound(
                a => {
                a.Address      = new("net.tcp://localhost/biztalk.factory/service.svc");
                a.Identity     = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.SecurityMode = SecurityMode.Message;
                a.MessageClientCredentialType = MessageCredentialType.Windows;
            });
            var xml = nta.GetAdapterBindingInfoSerializer().Serialize();

            xml.Should().Be(
                "<CustomProps>" +
                "<MaxReceivedMessageSize vt=\"3\">65535</MaxReceivedMessageSize>" +
                "<EnableTransaction vt=\"11\">0</EnableTransaction>" +
                "<TransactionProtocol vt=\"8\">OleTransactions</TransactionProtocol>" +
                "<SecurityMode vt=\"8\">Message</SecurityMode>" +
                "<MessageClientCredentialType vt=\"8\">Windows</MessageClientCredentialType>" +
                "<AlgorithmSuite vt=\"8\">Basic256</AlgorithmSuite>" +
                "<TransportClientCredentialType vt=\"8\">Windows</TransportClientCredentialType>" +
                "<TransportProtectionLevel vt=\"8\">EncryptAndSign</TransportProtectionLevel>" +
                "<UseSSO vt=\"11\">0</UseSSO>" +
                "<MaxConcurrentCalls vt=\"3\">200</MaxConcurrentCalls>" +
                "<LeaseTimeout vt=\"8\">00:05:00</LeaseTimeout>" +
                "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" +
                "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                "<OutboundXmlTemplate vt=\"8\">&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;</OutboundXmlTemplate>" +
                "<SuspendMessageOnFailure vt=\"11\">-1</SuspendMessageOnFailure>" +
                "<IncludeExceptionDetailInFaults vt=\"11\">-1</IncludeExceptionDetailInFaults>" +
                "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" +
                "<SendTimeout vt=\"8\">00:01:00</SendTimeout>" +
                "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" +
                "<Identity vt=\"8\">&lt;identity&gt;\r\n  &lt;servicePrincipalName value=\"service_spn\" /&gt;\r\n&lt;/identity&gt;</Identity>" +
                "</CustomProps>");
        }
        public void SerializeToXml()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var wha = new WcfWSHttpAdapter.Outbound(
                a => {
                a.Identity     = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.SecurityMode = SecurityMode.Message;
                a.SendTimeout  = TimeSpan.FromMinutes(2);
                a.TextEncoding = Encoding.Unicode;
            });
            var xml = wha.GetAdapterBindingInfoSerializer().Serialize();

            xml.Should().Be(
                "<CustomProps>" +
                "<MaxReceivedMessageSize vt=\"3\">65535</MaxReceivedMessageSize>" +
                "<MessageEncoding vt=\"8\">Text</MessageEncoding>" +
                "<TextEncoding vt=\"8\">utf-16</TextEncoding>" +
                "<EnableTransaction vt=\"11\">0</EnableTransaction>" +
                "<SecurityMode vt=\"8\">Message</SecurityMode>" +
                "<MessageClientCredentialType vt=\"8\">Windows</MessageClientCredentialType>" +
                "<AlgorithmSuite vt=\"8\">Basic256</AlgorithmSuite>" +
                "<NegotiateServiceCredential vt=\"11\">-1</NegotiateServiceCredential>" +
                "<EstablishSecurityContext vt=\"11\">-1</EstablishSecurityContext>" +
                "<TransportClientCredentialType vt=\"8\">Windows</TransportClientCredentialType>" +
                "<UseSSO vt=\"11\">0</UseSSO>" +
                "<ProxyToUse vt=\"8\">None</ProxyToUse>" +
                "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" +
                "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                "<OutboundXmlTemplate vt=\"8\">&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;</OutboundXmlTemplate>" +
                "<PropagateFaultMessage vt=\"11\">-1</PropagateFaultMessage>" +
                "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" +
                "<SendTimeout vt=\"8\">00:02:00</SendTimeout>" +
                "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" +
                "<Identity vt=\"8\">&lt;identity&gt;\r\n  &lt;servicePrincipalName value=\"service_spn\" /&gt;\r\n&lt;/identity&gt;</Identity>" +
                "</CustomProps>");
        }
Example #29
0
        public void SerializeToXml()
        {
            var bha = new WcfBasicHttpAdapter.Outbound(
                a => {
                a.Address      = new EndpointAddress("http://localhost/biztalk.factory/service.svc");
                a.Identity     = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.SecurityMode = BasicHttpSecurityMode.Message;
                a.SendTimeout  = TimeSpan.FromMinutes(2);
                a.TextEncoding = Encoding.Unicode;
            });
            var xml = ((IAdapterBindingSerializerFactory)bha).GetAdapterBindingSerializer().Serialize();

            Assert.That(
                xml,
                Is.EqualTo(
                    "<CustomProps>" +
                    "<MaxReceivedMessageSize vt=\"3\">65535</MaxReceivedMessageSize>" +
                    "<MessageEncoding vt=\"8\">Text</MessageEncoding>" +
                    "<TextEncoding vt=\"8\">utf-16</TextEncoding>" +
                    "<SecurityMode vt=\"8\">Message</SecurityMode>" +
                    "<MessageClientCredentialType vt=\"8\">UserName</MessageClientCredentialType>" +
                    "<AlgorithmSuite vt=\"8\">Basic256</AlgorithmSuite>" +
                    "<TransportClientCredentialType vt=\"8\">None</TransportClientCredentialType>" +
                    "<UseAcsAuthentication vt=\"11\">0</UseAcsAuthentication>" +
                    "<UseSSO vt=\"11\">0</UseSSO>" +
                    "<ProxyToUse vt=\"8\">None</ProxyToUse>" +
                    "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" +
                    "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                    "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                    "<OutboundXmlTemplate vt=\"8\">&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;</OutboundXmlTemplate>" +
                    "<PropagateFaultMessage vt=\"11\">-1</PropagateFaultMessage>" +
                    "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" +
                    "<SendTimeout vt=\"8\">00:02:00</SendTimeout>" +
                    "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" +
                    "<Identity vt=\"8\">&lt;identity&gt;\r\n  &lt;servicePrincipalName value=\"service_spn\" /&gt;\r\n&lt;/identity&gt;</Identity>" +
                    "</CustomProps>"));
        }
        public void SerializeToXml()
        {
            Skip.IfNot(BizTalkServerGroup.IsConfigured);

            var bha = new WcfBasicHttpAdapter.Inbound(
                a => {
                a.Address  = new("/biztalk.factory/service.svc", UriKind.Relative);
                a.Identity = EndpointIdentityFactory.CreateSpnIdentity("service_spn");
                a.MessageClientCredentialType = BasicHttpMessageCredentialType.Certificate;
                a.SecurityMode = BasicHttpSecurityMode.Message;
                a.TextEncoding = Encoding.Unicode;
            });
            var xml = bha.GetAdapterBindingInfoSerializer().Serialize();

            xml.Should().Be(
                "<CustomProps>" +
                "<MaxReceivedMessageSize vt=\"3\">65535</MaxReceivedMessageSize>" +
                "<MessageEncoding vt=\"8\">Text</MessageEncoding>" +
                "<TextEncoding vt=\"8\">utf-16</TextEncoding>" +
                "<SecurityMode vt=\"8\">Message</SecurityMode>" +
                "<MessageClientCredentialType vt=\"8\">Certificate</MessageClientCredentialType>" +
                "<AlgorithmSuite vt=\"8\">Basic256</AlgorithmSuite>" +
                "<TransportClientCredentialType vt=\"8\">None</TransportClientCredentialType>" +
                "<UseSSO vt=\"11\">0</UseSSO>" +
                "<MaxConcurrentCalls vt=\"3\">200</MaxConcurrentCalls>" +
                "<InboundBodyLocation vt=\"8\">UseBodyElement</InboundBodyLocation>" +
                "<InboundNodeEncoding vt=\"8\">Xml</InboundNodeEncoding>" +
                "<OutboundBodyLocation vt=\"8\">UseBodyElement</OutboundBodyLocation>" +
                "<OutboundXmlTemplate vt=\"8\">&lt;bts-msg-body xmlns=\"http://www.microsoft.com/schemas/bts2007\" encoding=\"xml\"/&gt;</OutboundXmlTemplate>" +
                "<SuspendMessageOnFailure vt=\"11\">-1</SuspendMessageOnFailure>" +
                "<IncludeExceptionDetailInFaults vt=\"11\">-1</IncludeExceptionDetailInFaults>" +
                "<OpenTimeout vt=\"8\">00:01:00</OpenTimeout>" +
                "<SendTimeout vt=\"8\">00:01:00</SendTimeout>" +
                "<CloseTimeout vt=\"8\">00:01:00</CloseTimeout>" +
                "<Identity vt=\"8\">&lt;identity&gt;\r\n  &lt;servicePrincipalName value=\"service_spn\" /&gt;\r\n&lt;/identity&gt;</Identity>" +
                "</CustomProps>");
        }