public NCMForwarderInfoService(string username, string password)
 {
     _endpoint = Settings.Default.NCMForwarderEndpointPath;
     _endpointConfigName = "OrionTcpBinding_InformationServicev2";
     _binding = new NetTcpBinding("TransportMessage");
     _credentials = new UsernameCredentials(username, password);
 }
 public OrionInfoServiceCompressed(string username, string password, bool v3 = false)
 {
     _endpoint = v3 ? Settings.Default.OrionV3EndpointPathCompressed : Settings.Default.OrionEndpointPathCompressed;
     _endpointConfigName = "OrionTcpBindingCompressed";
     _binding = new CustomBinding("CompressedUserName");
     _credentials = new UsernameCredentials(username, password);
 }
示例#3
0
 public OrionInfoService(string username, string password, bool v3 = false)
 {
     _v3 = v3;
     _endpoint = v3 ? Settings.Default.OrionV3EndpointPath : Settings.Default.OrionEndpointPath;
     _endpointConfigName = "OrionTcpBinding_InformationServicev2";
     _binding = new NetTcpBinding("TransportMessage");
     _credentials = new UsernameCredentials(username, password);
 }
 public OrionHttpsInfoService(string username, string password, bool v3 = false)
 {
     _protocolName = "https";
     _endpoint = v3 ? Settings.Default.OrionV3HttpsEndpointPath : Settings.Default.OrionHttpsEndpointPath;
     _endpointConfigName = "OrionHttpBinding_InformationServicev2";
     _binding = new BasicHttpBinding("SWIS.Over.HTTP");
     _credentials = new UsernameCredentials(username, password);
 }
示例#5
0
        public JavaHttpInfoService(string username, string password)
        {
            _endpointConfigName = "JavaHttpBinding_InformationServicev2";
            _endpoint = Settings.Default.JavaEndpointPath;

            _binding = new WSHttpBinding("javaBinding");
            _protocolName = "https";
            _credentials = new UsernameCredentials(username, password);

             ServicePointManager.ServerCertificateValidationCallback = ValidateRemoteCertificate;
        }
示例#6
0
        private InfoServiceProxy ConnectNetTcp()
        {
            InfoServiceProxy infoServiceProxy;
            EndpointAddresses addresses = V2.IsPresent ? (EndpointAddresses)new V2EndpointAddresses() : new V3EndpointAddresses();

            if (Trusted.IsPresent)
            {
                var binding = new NetTcpBinding {MaxReceivedMessageSize = int.MaxValue, MaxBufferSize = int.MaxValue};
                binding.Security.Mode = SecurityMode.Transport;
                binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;

                var uri = new Uri(string.Format(addresses.activeDirectory, Hostname ?? "localhost"));

                infoServiceProxy = new InfoServiceProxy(uri, binding, new WindowsCredential());
            }
            else if (Certificate.IsPresent)
            {
                var binding = new NetTcpBinding(SecurityMode.Transport) {MaxReceivedMessageSize = int.MaxValue, MaxBufferSize = int.MaxValue};
                binding.Security.Mode = SecurityMode.Transport;
                binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Certificate;
                binding.ReaderQuotas.MaxArrayLength = int.MaxValue;
                binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;

                if (Streamed.IsPresent)
                {
                    binding.TransferMode = TransferMode.Streamed;
                    binding.PortSharingEnabled = true;
                    binding.ReceiveTimeout = new TimeSpan(15,0,0);
                    binding.SendTimeout = new TimeSpan(15, 0, 0);
                }

                var address = (Streamed && !V2.IsPresent)
                                  ? ((V3EndpointAddresses) addresses).streamedCertificate
                                  : addresses.certificate;

                var uri = new Uri(string.Format(address, Hostname ?? "localhost"));

                ServiceCredentials credentials = new MyCertificateCredential("SolarWinds-Orion", StoreLocation.LocalMachine, StoreName.My);

                infoServiceProxy = new InfoServiceProxy(uri, binding, credentials);
            }
            else
            {
                var binding = new NetTcpBinding {MaxReceivedMessageSize = int.MaxValue, MaxBufferSize = int.MaxValue};
                binding.Security.Mode = SecurityMode.TransportWithMessageCredential;
                binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;

                var uri = new Uri(string.Format(addresses.usernamePassword, Hostname ?? "localhost"));

                string username = string.Empty;
                string password = string.Empty;

                if (IsUserNamePresent)
                {
                    SecureString securePassword = StringToSecureString(this.Password);
                    this.Credential = new PSCredential(this.UserName, securePassword);
                }

                // the credential dialog adds a slash at the beginning, need to strip
                username = Credential.UserName.TrimStart('\\');
                password = SecureStringToString(Credential.Password);

                var credentials = new UsernameCredentials(username, password);

                infoServiceProxy = new InfoServiceProxy(uri, binding, credentials);
            }
            return infoServiceProxy;
        }
示例#7
0
        private static InfoServiceProxy ConnectSoap12(Uri address, string username, string password)
        {
            var binding = new WSHttpBinding(SecurityMode.Transport);
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
            binding.Security.Message.ClientCredentialType = MessageCredentialType.UserName;
            binding.ReaderQuotas.MaxDepth = 32;
            binding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
            binding.ReaderQuotas.MaxArrayLength = int.MaxValue;
            binding.MaxReceivedMessageSize = int.MaxValue;
            binding.AllowCookies = true;
            binding.ReaderQuotas.MaxBytesPerRead = 4096;
            binding.ReaderQuotas.MaxNameTableCharCount = 16384;
            binding.UseDefaultWebProxy = true;

            var credentials = new UsernameCredentials(username, password);

            return new InfoServiceProxy(address, binding, credentials);
        }