Uredi

Deli z drugimi prek


LocalServiceSecuritySettings Class

Definition

Provides local service security properties that can be set.

public ref class LocalServiceSecuritySettings sealed
public sealed class LocalServiceSecuritySettings
type LocalServiceSecuritySettings = class
Public NotInheritable Class LocalServiceSecuritySettings
Inheritance
LocalServiceSecuritySettings

Examples

This example shows how to use the LocalServiceSecuritySettings class to change the DetectReplays setting.

    // 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 colllection.
    // Important: Cast to the SymmetricSecurityBindingElement when using the Find
    // method.
    SymmetricSecurityBindingElement sbe = (SymmetricSecurityBindingElement)
bec.Find<SecurityBindingElement>();

    // Get the LocalServiceSettings from the binding element.
    LocalServiceSecuritySettings lss = sbe.LocalServiceSettings;

    // Print out values.
    Console.WriteLine("DetectReplays: {0} days", lss.DetectReplays);
    Console.WriteLine("ReplayWindow: {0} minutes", lss.ReplayWindow.Minutes);
    Console.WriteLine("MaxClockSkew: {0} minutes", lss.MaxClockSkew.Minutes);

    Console.ReadLine();
    Console.WriteLine("Press Enter to Continue");
    // Change the MaxClockSkew to 3 minutes.
    lss.MaxClockSkew = new TimeSpan(0, 0, 3, 0);

    // Print the new value.
    Console.WriteLine("New MaxClockSkew: {0} minutes", lss.MaxClockSkew.Minutes);
    Console.WriteLine("Press Enter to End");
    Console.ReadLine();

    // Create a URI for the service.
    Uri httpUri = new Uri("http://localhost/calculator");

    // Create a ServiceHost. The binding has the changed MaxClockSkew.
    ServiceHost sh = new ServiceHost(typeof(Calculator), httpUri);
    sh.AddServiceEndpoint(typeof(ICalculator), b, "");
    // sh.Open();
    // Console.WriteLine("Listening");
    // Console.ReadLine();
    // sh.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 colllection.
' Important: Cast to the SymmetricSecurityBindingElement when using the Find
' method.
Dim sbe As SymmetricSecurityBindingElement = CType(bec.Find(Of SecurityBindingElement)(), SymmetricSecurityBindingElement)

' Get the LocalServiceSettings from the binding element.
Dim lss As LocalServiceSecuritySettings = sbe.LocalServiceSettings

' Print out values.
Console.WriteLine("DetectReplays: {0} days", lss.DetectReplays)
Console.WriteLine("ReplayWindow: {0} minutes", lss.ReplayWindow.Minutes)
Console.WriteLine("MaxClockSkew: {0} minutes", lss.MaxClockSkew.Minutes)

Console.ReadLine()
Console.WriteLine("Press Enter to Continue")
' Change the MaxClockSkew to 3 minutes.
lss.MaxClockSkew = New TimeSpan(0, 0, 3, 0)

' Print the new value.
Console.WriteLine("New MaxClockSkew: {0} minutes", lss.MaxClockSkew.Minutes)
Console.WriteLine("Press Enter to End")
Console.ReadLine()

' Create a URI for the service.
Dim httpUri As New Uri("http://localhost/calculator")

' Create a ServiceHost. The binding has the changed MaxClockSkew.
Dim sh As New ServiceHost(GetType(Calculator), httpUri)
sh.AddServiceEndpoint(GetType(ICalculator), b, "")
' sh.Open();
' Console.WriteLine("Listening");
' Console.ReadLine();
' sh.Close();

Remarks

This class contains the local security settings used by the SecurityBindingElement to build the security channel. These settings are local to the service and are not represented in the service's security policy.

Constructors

LocalServiceSecuritySettings()

Initializes a new instance of the LocalServiceSecuritySettings class.

Properties

DetectReplays

Gets or sets a value that indicates whether replay detection is enabled on the service.

InactivityTimeout

Gets or sets the duration to wait before the channel is closed due to inactivity.

IssuedCookieLifetime

Gets or sets the lifetime for the SecurityContextSecurityToken that the service issues for the client.

MaxCachedCookies

Gets or sets the maximum number of SecurityContextSecurityTokens that the service allows to cache at once.

MaxClockSkew

Gets or sets the maximum allowable time difference between the system clocks of the two parties that are communicating.

MaxPendingSessions

Gets or sets the maximum number of concurrent security sessions that are established with the server for which it has issued a session token but for which no application messages are sent.

MaxStatefulNegotiations

Gets or sets the maximum number of concurrent security negotiations with clients that the service can participate in.

NegotiationTimeout

Gets or sets the maximum duration of the security negotiation phase between client and service.

NonceCache

Gets or sets the cache for the local service security settings.

ReconnectTransportOnFailure

Gets or sets a value that indicates whether security sessions attempt to reconnect after transport failures.

ReplayCacheSize

Gets or sets the size of the nonce cache used for replay detection.

ReplayWindow

Gets or sets the maximum amount of time within which the service can accept a message.

SessionKeyRenewalInterval

Gets or sets the lifetime of a key used in a security session. When this interval expires the key is automatically renewed.

SessionKeyRolloverInterval

Gets or sets the time interval after key renewal for which the previous session key is valid on incoming messages during a key renewal.

TimestampValidityDuration

Gets or sets the maximum duration of time that messages are valid when sent by the service. If the client receives the service's message after this duration, it discards the message.

Methods

Clone()

Creates a new instance of this class from the current instance.

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)

Applies to