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()

建立這個類別的新執行個體,這是目前執行個體的複本或複製 (Clone)。

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 Object)

適用於

另請參閱