LocalClientSecuritySettings 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
指定本地客户端安全设置。
public ref class LocalClientSecuritySettings sealed
public sealed class LocalClientSecuritySettings
type LocalClientSecuritySettings = class
Public NotInheritable Class LocalClientSecuritySettings
- 继承
-
LocalClientSecuritySettings
示例
此示例演示如何使用该 LocalClientSecuritySettings 类。
// Create an instance of the binding to use.
WSHttpBinding b = new WSHttpBinding();
// Get the binding element collection.
BindingElementCollection bec = b.CreateBindingElements();
// Find the SymmetricSecurityBindingElement in the collection.
// Important: Cast to the SymmetricSecurityBindingElement when using the Find
// method.
SymmetricSecurityBindingElement sbe = (SymmetricSecurityBindingElement)
bec.Find<SecurityBindingElement>();
// Get the LocalSecuritySettings from the binding element.
LocalClientSecuritySettings lc = sbe.LocalClientSettings;
// Print out values.
Console.WriteLine("Maximum cookie caching time: {0} days", lc.MaxCookieCachingTime.Days);
Console.WriteLine("Replay Cache Size: {0}", lc.ReplayCacheSize);
Console.WriteLine("ReplayWindow: {0} minutes", lc.ReplayWindow.Minutes);
Console.WriteLine("MaxClockSkew: {0} minutes", lc.MaxClockSkew.Minutes);
Console.ReadLine();
// Change the MaxClockSkew to 3 minutes.
lc.MaxClockSkew = new TimeSpan(0, 0, 3, 0);
// Print the new value.
Console.WriteLine("New MaxClockSkew: {0} minutes", lc.MaxClockSkew.Minutes);
Console.ReadLine();
// Create an EndpointAddress for the service.
EndpointAddress ea = new EndpointAddress("http://localhost/calculator");
// Create a client. The binding has the changed MaxClockSkew.
// CalculatorClient cc = new CalculatorClient(b, ea);
// Use the new client. (Not shown.)
// cc.Close();
' Create an instance of the binding to use.
Dim b As New WSHttpBinding()
' Get the binding element collection.
Dim bec As BindingElementCollection = b.CreateBindingElements()
' Find the SymmetricSecurityBindingElement in the collection.
' Important: Cast to the SymmetricSecurityBindingElement when using the Find
' method.
Dim sbe As SymmetricSecurityBindingElement = CType(bec.Find(Of SecurityBindingElement)(), SymmetricSecurityBindingElement)
' Get the LocalSecuritySettings from the binding element.
Dim lc As LocalClientSecuritySettings = sbe.LocalClientSettings
' Print out values.
Console.WriteLine("Maximum cookie caching time: {0} days", lc.MaxCookieCachingTime.Days)
Console.WriteLine("Replay Cache Size: {0}", lc.ReplayCacheSize)
Console.WriteLine("ReplayWindow: {0} minutes", lc.ReplayWindow.Minutes)
Console.WriteLine("MaxClockSkew: {0} minutes", lc.MaxClockSkew.Minutes)
Console.ReadLine()
' Change the MaxClockSkew to 3 minutes.
lc.MaxClockSkew = New TimeSpan(0, 0, 3, 0)
' Print the new value.
Console.WriteLine("New MaxClockSkew: {0} minutes", lc.MaxClockSkew.Minutes)
Console.ReadLine()
' Create an EndpointAddress for the service.
Dim ea As New EndpointAddress("http://localhost/calculator")
' Create a client. The binding has the changed MaxClockSkew.
' CalculatorClient cc = new CalculatorClient(b, ea);
' Use the new client. (Not shown.)
' cc.Close();
注解
此类包含( SecurityBindingElement 派生自它的类)用来生成安全通道的本地安全设置。 这些设置是客户端的本地设置,不是从服务的安全策略确定的。
构造函数
| 名称 | 说明 |
|---|---|
| LocalClientSecuritySettings() |
初始化 LocalClientSecuritySettings 类的新实例。 |
属性
| 名称 | 说明 |
|---|---|
| CacheCookies |
获取或设置一个值,该值指示是否缓存安全会话 Cookie。 |
| CookieRenewalThresholdPercentage |
获取或设置安全会话 Cookie 续订的阈值百分比。 |
| DetectReplays |
获取或设置一个值,该值指示是否在客户端从服务接收的消息上启用重播检测。 |
| IdentityVerifier |
获取或设置标识验证程序。 |
| MaxClockSkew |
获取或设置通信双方的系统时钟之间的最大允许时间差。 |
| MaxCookieCachingTime |
获取或设置安全会话 Cookie 的最大缓存时间。 |
| NonceCache |
获取或设置本地客户端安全设置的缓存。 |
| ReconnectTransportOnFailure |
获取或设置一个值,该值指示安全会话是否在传输失败后尝试重新连接。 |
| ReplayCacheSize |
获取或设置用于重播检测的缓存 nonces 的数量。 |
| ReplayWindow |
获取或设置消息 nonce 有效的最大时间。 |
| SessionKeyRenewalInterval |
获取或设置发起程序续订安全会话密钥的时间跨度。 |
| SessionKeyRolloverInterval |
获取或设置在密钥续订期间上一个会话密钥对传入消息有效的时间间隔。 |
| TimestampValidityDuration |
获取或设置客户端发送消息时有效的最大持续时间。 如果服务在此持续时间后收到消息,则应放弃该消息。 |
方法
| 名称 | 说明 |
|---|---|
| Clone() |
创建此类的新实例,该实例是当前实例的副本或克隆。 |
| Equals(Object) |
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
用作默认哈希函数。 (继承自 Object) |
| GetType() |
获取当前实例的 Type。 (继承自 Object) |
| MemberwiseClone() |
创建当前 Object的浅表副本。 (继承自 Object) |
| ToString() |
返回一个表示当前对象的字符串。 (继承自 Object) |