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 (及其衍生類別)。 這些設定是本地於用戶端的,並非由服務的安全政策決定。
建構函式
| 名稱 | Description |
|---|---|
| LocalClientSecuritySettings() |
初始化 LocalClientSecuritySettings 類別的新執行個體。 |
屬性
| 名稱 | Description |
|---|---|
| CacheCookies |
取得或設定一個值,指示安全對話 Cookie 是否被快取。 |
| CookieRenewalThresholdPercentage |
取得或設定安全對話 Cookie 續約的門檻百分比。 |
| DetectReplays |
取得或設定一個值,指示用戶端從服務收到的訊息是否啟用重播偵測。 |
| IdentityVerifier |
取得或設定身份驗證器。 |
| MaxClockSkew |
取得或設定通訊雙方系統時鐘間最大允許的時間差。 |
| MaxCookieCachingTime |
取得或設定安全對話 Cookie 的最大快取時間。 |
| NonceCache |
為本地客戶端的安全設定取得或設定快取。 |
| ReconnectTransportOnFailure |
取得或設定一個值,指示安全會話在傳輸失敗後是否嘗試重新連線。 |
| ReplayCacheSize |
取得或設定用於重播偵測的快取 nonce 數量。 |
| ReplayWindow |
取得或設定訊息 nonce 有效的最長時間。 |
| SessionKeyRenewalInterval |
取得或設定啟動者更新安全會話金鑰的時間範圍。 |
| SessionKeyRolloverInterval |
在金鑰續期期間,取得或設定上一個會話金鑰對收到訊息有效的時間間隔。 |
| TimestampValidityDuration |
取得或設定客戶端發送訊息有效的最長時長。 如果服務在此時間後仍收到訊息,應將其丟棄。 |
方法
| 名稱 | Description |
|---|---|
| Clone() |
建立這個類別的新實例,該實例是目前實例的複製或複製。 |
| Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
| GetHashCode() |
做為預設哈希函式。 (繼承來源 Object) |
| GetType() |
取得目前實例的 Type。 (繼承來源 Object) |
| MemberwiseClone() |
建立目前 Object的淺層複本。 (繼承來源 Object) |
| ToString() |
傳回表示目前 物件的字串。 (繼承來源 Object) |