当前位置: 首页>>代码示例>>C#>>正文


C# SecurityMode类代码示例

本文整理汇总了C#中SecurityMode的典型用法代码示例。如果您正苦于以下问题:C# SecurityMode类的具体用法?C# SecurityMode怎么用?C# SecurityMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SecurityMode类属于命名空间,在下文中一共展示了SecurityMode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UserNameWSTrustBinding

 public UserNameWSTrustBinding(SecurityMode securityMode) : base(securityMode)
 {
     if (SecurityMode.Message == securityMode)
     {
         _clientCredentialType = HttpClientCredentialType.None;
     }
 }
开发者ID:LiyeXu,项目名称:PnP-Sites-Core,代码行数:7,代码来源:UserNameWSTrustBinding.cs

示例2: BindingProperties

        public BindingProperties(SecurityMode securityMode, MessageCredentialType messageCredentialType, 
            TcpClientCredentialType tcpClientCredentialType, ProtectionLevel protectionLevel,
            int maxConnections, long maxReceivedMessageSize, long maxBufferPoolSize, int maxArrayLength, 
            int maxBytesPerRead, int maxDepth, int maxStringContentLength, int maxBufferSize,
            TimeSpan openTimeout, TimeSpan closeTimeout, TimeSpan receiveTimeout, TimeSpan sendTimeout)
        {
            m_SecurityMode = securityMode;
            m_MessageCredentialType = messageCredentialType;
            m_TcpClientCredentialType = tcpClientCredentialType;
            m_ProtectionLevel = protectionLevel;

            m_MaxConnections = maxConnections;
            m_MaxReceivedMessageSize = maxReceivedMessageSize;
            m_MaxBufferPoolSize = maxBufferPoolSize;
            m_MaxArrayLength = maxArrayLength;
            m_MaxBytesPerRead = maxBytesPerRead;
            m_MaxDepth = maxDepth;
            m_MaxStringContentLength = maxStringContentLength;
            m_MaxBufferSize = maxBufferSize;

            m_OpenTimeout = openTimeout;
            m_CloseTimeout = closeTimeout;
            m_ReceiveTimeout = receiveTimeout;
            m_SendTimeout = sendTimeout;
        }
开发者ID:JackFong,项目名称:GenericWcfServiceHostAndClient,代码行数:25,代码来源:BindingTypes.cs

示例3: IssuedTokenWSTrustBinding

 public IssuedTokenWSTrustBinding(Binding issuerBinding, EndpointAddress issuerAddress, SecurityMode mode, TrustVersion version, SecurityKeyType keyType, SecurityAlgorithmSuite algorithmSuite, string tokenType, IEnumerable<ClaimTypeRequirement> claimTypeRequirements, EndpointAddress issuerMetadataAddress)
     : base(mode, version)
 {
     this._claimTypeRequirements = new Collection<ClaimTypeRequirement>();
   
     if ((SecurityMode.Message != mode) && (SecurityMode.TransportWithMessageCredential != mode))
     {
         throw new InvalidOperationException("ID3226");
     }
     if ((this._keyType == SecurityKeyType.BearerKey) && (version == TrustVersion.WSTrustFeb2005))
     {
         throw new InvalidOperationException("ID3267");
     }
     
     this._keyType = keyType;
     this._algorithmSuite = algorithmSuite;
     this._tokenType = tokenType;
     this._issuerBinding = issuerBinding;
     this._issuerAddress = issuerAddress;
     this._issuerMetadataAddress = issuerMetadataAddress;
     
     if (claimTypeRequirements != null)
     {
         foreach (ClaimTypeRequirement requirement in claimTypeRequirements)
         {
             this._claimTypeRequirements.Add(requirement);
         }
     }
 }
开发者ID:Rameshcyadav,项目名称:Thinktecture.IdentityModel.45,代码行数:29,代码来源:IssuedTokenWSTrustBinding.cs

示例4: WSTrust13Binding

    protected WSTrust13Binding(SecurityMode securityMode)
    {
        this._securityMode = SecurityMode.Message;

        ValidateSecurityMode(securityMode);
        this._securityMode = securityMode;
    }
开发者ID:timritzer,项目名称:LivingTheArchitecture,代码行数:7,代码来源:WSTrust13Binding.cs

示例5: WS2007HttpBinding

 public WS2007HttpBinding(SecurityMode securityMode, bool reliableSessionEnabled)
     : base(securityMode, reliableSessionEnabled)
 {
     this.ReliableSessionBindingElement.ReliableMessagingVersion = WS2007ReliableMessagingVersion;
     this.TransactionFlowBindingElement.TransactionProtocol = WS2007TransactionProtocol;
     this.HttpsTransport.MessageSecurityVersion = WS2007MessageSecurityVersion;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:WS2007HttpBinding.cs

示例6: IsDefined

 public static bool IsDefined(SecurityMode value)
 {
     return (value == SecurityMode.None ||
         value == SecurityMode.Transport ||
         value == SecurityMode.Message ||
         value == SecurityMode.TransportWithMessageCredential);
 }
开发者ID:SoumikMukherjeeDOTNET,项目名称:wcf,代码行数:7,代码来源:SecurityMode.cs

示例7: NetSparkleDSAVerificator

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="mode">The security mode of the validator. Control what parts has to be exist</param>
        /// <param name="publicKey">the public key as string (will be prefered before the file)</param>
        /// <param name="publicKeyFile">the public key file</param>
        public NetSparkleDSAVerificator(SecurityMode mode, String publicKey = null, String publicKeyFile = "NetSparkle_DSA.pub")
        {
            _securityMode = mode;

            String key = publicKey;

            if (string.IsNullOrEmpty(key))
            {
                // TODO: Loading Ressources don't work
                Stream data = TryGetResourceStream(publicKeyFile);
                if (data == null)
                    data = TryGetFileResource(publicKeyFile, data);

                if (data != null)
                {
                    using (StreamReader reader = new StreamReader(data))
                    {
                        key = reader.ReadToEnd();
                    }
                }
            }

            if (!string.IsNullOrEmpty(key))
            {
                try
                {
                    _provider = new DSACryptoServiceProvider();
                    _provider.FromXmlString(key);
                }
                catch
                {
                    _provider = null;
                }
            }
        }
开发者ID:Deadpikle,项目名称:NetSparkle,代码行数:41,代码来源:NetSparkleDSAVerificator.cs

示例8: BusinessServicesClientConfigEntity

 /// <summary>
 /// Initializes a new instance of the <see cref="BusinessServicesClientConfigEntity"/> class.
 /// </summary>
 /// <param name="host">The host.</param>
 /// <param name="port">The port.</param>
 /// <param name="servicesName">Name of the services.</param>
 /// <param name="securityMode">The binding security mode.</param>
 public BusinessServicesClientConfigEntity(string host, int port, string servicesName, SecurityMode? securityMode)
 {
     _host = host;
     _port = port;
     _servicesName = servicesName;
     _securityMode = securityMode;
 }
开发者ID:rickeygalloway,项目名称:Test,代码行数:14,代码来源:BusinessServicesClientConfigEntity.cs

示例9: NetTcpSecurity

        NetTcpSecurity(SecurityMode mode, TcpTransportSecurity transportSecurity, MessageSecurityOverTcp messageSecurity)
        {
            Fx.Assert(SecurityModeHelper.IsDefined(mode), string.Format("Invalid SecurityMode value: {0}.", mode.ToString()));

            this.mode = mode;
            this.transportSecurity = transportSecurity == null ? new TcpTransportSecurity() : transportSecurity;
            this.messageSecurity = messageSecurity == null ? new MessageSecurityOverTcp() : messageSecurity;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:8,代码来源:NetTcpSecurity.cs

示例10: ValidateSecurityMode

    protected static void ValidateSecurityMode(SecurityMode securityMode)
    {
        SecurityMode[] allowedModes = { SecurityMode.Message, SecurityMode.Transport, SecurityMode.TransportWithMessageCredential };

        if (!allowedModes.Contains(securityMode))
        {
            throw new ArgumentException();
        }
    }
开发者ID:timritzer,项目名称:LivingTheArchitecture,代码行数:9,代码来源:WSTrust13Binding.cs

示例11: Main

		public static int Main (string[] args)
		{
			using (ServiceHost host = new ServiceHost (typeof (HangmanService)))
			{
				var security = new SecurityMode ();
				host.AddServiceEndpoint (
					typeof(IHangmanService),
					new WSHttpBinding (security, true),
					"http://localhost:8325/");

				host.Open ();

				/*
				Console.WriteLine ("Type [CR] to stop ...");
				Console.ReadKey ();
				*/

				/* Demon */
				UnixSignal sigint = new UnixSignal (Signum.SIGINT);
				UnixSignal sigterm = new UnixSignal (Signum.SIGTERM);
				UnixSignal sighup = new UnixSignal (Signum.SIGHUP);
				UnixSignal sigusr2 = new UnixSignal (Signum.SIGUSR2);
				UnixSignal [] signals = new UnixSignal[]
					{
						sigint,
						sigterm,
						sighup,
						sigusr2
					};

				bool exit = false;
				while (!exit)
				{
					int id = UnixSignal.WaitAny (signals);

					if (id >= 0 && id < signals.Length)
					{
						if (sigint.IsSet || sigterm.IsSet)
						{
							sigint.Reset ();
							sigterm.Reset ();
							exit = true;
						} else if (sighup.IsSet)
							sighup.Reset ();
						else if (sigusr2.IsSet)
							sighup.Reset ();

					}
				}
				/* Demon */

				host.Close ();
			}

			return 0;
		}
开发者ID:dms-cmt,项目名称:hangman-service,代码行数:56,代码来源:Program.cs

示例12: NewBinding

    public static Binding NewBinding(SecurityMode securityMode)
    {
      Contract.Ensures(Contract.Result<Binding>() != null);

#if WS_HTTP_BINDING
      return new WSDualHttpBinding(securityMode);
#elif NET_TCP_BINDING
      return new NetTcpBinding(securityMode);
#endif
    }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:10,代码来源:ClousotServiceCommon.cs

示例13: CreateForLongOperation

		private static ServiceConfiguration CreateForLongOperation(SecurityMode securityMode)
		{
			return
				new ServiceConfiguration(
					new NetTcpBinding(securityMode),
					HostName,
					Port,
					int.MaxValue,
					int.MaxValue,
					true);
		}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:11,代码来源:NetTcpServiceConfigurationFactory.cs

示例14: Ctor_Default_Initializes_Properties

    public static void Ctor_Default_Initializes_Properties(SecurityMode securityMode)
    {
        var binding = new NetTcpBinding(securityMode);

        Assert.Equal<EnvelopeVersion>(EnvelopeVersion.Soap12, binding.EnvelopeVersion);
        Assert.Equal<long>(512 * 1024, binding.MaxBufferPoolSize);
        Assert.Equal<long>(65536, binding.MaxBufferSize);
        Assert.True(TestHelpers.XmlDictionaryReaderQuotasAreEqual(binding.ReaderQuotas, new XmlDictionaryReaderQuotas()), "XmlDictionaryReaderQuotas");
        Assert.Equal<string>("net.tcp", binding.Scheme);
        Assert.Equal<TransferMode>(TransferMode.Buffered, binding.TransferMode);
        Assert.Equal<SecurityMode>(securityMode, binding.Security.Mode);
    }
开发者ID:weshaggard,项目名称:wcf,代码行数:12,代码来源:NetTcpBindingTest.cs

示例15: SetTransportSecurity

 internal static bool SetTransportSecurity(BindingElement transport, SecurityMode mode, TcpTransportSecurity transportSecurity)
 {
     if (mode == SecurityMode.TransportWithMessageCredential)
     {
         return TcpTransportSecurity.SetTransportProtectionOnly(transport, transportSecurity);
     }
     if (mode == SecurityMode.Transport)
     {
         return TcpTransportSecurity.SetTransportProtectionAndAuthentication(transport, transportSecurity);
     }
     return (transport == null);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:12,代码来源:NetTcpSecurity.cs


注:本文中的SecurityMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。