本文整理汇总了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;
}
}
示例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;
}
示例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);
}
}
}
示例4: WSTrust13Binding
protected WSTrust13Binding(SecurityMode securityMode)
{
this._securityMode = SecurityMode.Message;
ValidateSecurityMode(securityMode);
this._securityMode = securityMode;
}
示例5: WS2007HttpBinding
public WS2007HttpBinding(SecurityMode securityMode, bool reliableSessionEnabled)
: base(securityMode, reliableSessionEnabled)
{
this.ReliableSessionBindingElement.ReliableMessagingVersion = WS2007ReliableMessagingVersion;
this.TransactionFlowBindingElement.TransactionProtocol = WS2007TransactionProtocol;
this.HttpsTransport.MessageSecurityVersion = WS2007MessageSecurityVersion;
}
示例6: IsDefined
public static bool IsDefined(SecurityMode value)
{
return (value == SecurityMode.None ||
value == SecurityMode.Transport ||
value == SecurityMode.Message ||
value == SecurityMode.TransportWithMessageCredential);
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例10: ValidateSecurityMode
protected static void ValidateSecurityMode(SecurityMode securityMode)
{
SecurityMode[] allowedModes = { SecurityMode.Message, SecurityMode.Transport, SecurityMode.TransportWithMessageCredential };
if (!allowedModes.Contains(securityMode))
{
throw new ArgumentException();
}
}
示例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;
}
示例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
}
示例13: CreateForLongOperation
private static ServiceConfiguration CreateForLongOperation(SecurityMode securityMode)
{
return
new ServiceConfiguration(
new NetTcpBinding(securityMode),
HostName,
Port,
int.MaxValue,
int.MaxValue,
true);
}
示例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);
}
示例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);
}