LocalClientSecuritySettings 类

定义

指定本地客户端安全设置。

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

获取或设置用于重播检测的缓存 Nonce 的数目。

ReplayWindow

获取或设置消息 Nonce 有效的最长时间。

SessionKeyRenewalInterval

获取或设置一个时间跨度,此时间之后发起方续订用于安全会话的密钥。

SessionKeyRolloverInterval

获取或设置一个时间间隔,这段时间间隔内上一个会话密钥在密钥续订期间对传入的消息有效。

TimestampValidityDuration

获取或设置消息在由客户端发送时的最长有效时间。 如果服务在此期间后收到消息,应丢弃该消息。

方法

Clone()

创建此类的新实例,它是当前实例的一个副本或复本。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于

另请参阅