SessionSecurityToken Constructor (ClaimsPrincipal, UniqueId, String, String, DateTime, TimeSpan, SymmetricSecurityKey)

.NET Framework (current version)
 

Initializes a new instance of the SessionSecurityToken class by using the specified principal, context ID, context, endpoint, valid timestamp, lifetime, and key.

Namespace:   System.IdentityModel.Tokens
Assembly:  System.IdentityModel (in System.IdentityModel.dll)

public SessionSecurityToken(
	ClaimsPrincipal claimsPrincipal,
	UniqueId contextId,
	string context,
	string endpointId,
	DateTime validFrom,
	TimeSpan lifetime,
	SymmetricSecurityKey key
)

Parameters

claimsPrincipal
Type: System.Security.Claims.ClaimsPrincipal

The claims principal that is associated with this session.

contextId
Type: System.Xml.UniqueId

The context identifier associated with this token.

context
Type: System.String

An optional, application-specific context string.

endpointId
Type: System.String

The endpoint to which this token is bound. An empty string creates an unscoped token.

validFrom
Type: System.DateTime

The time at which the token becomes valid.

lifetime
Type: System.TimeSpan

The lifetime of the session token. The ValidTo property will be set to ValidFrom plus the period specified by this parameter.

key
Type: System.IdentityModel.Tokens.SymmetricSecurityKey

An optional symmetric session key.

Exception Condition
ArgumentNullException

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal is null.

-or-

contextId is null.

-or-

endpointId is null.

InvalidOperationException

lifetime is less than or equal to Zero.

The following table shows initial property values for an instance of the SessionSecurityToken class.

Property

Initial Value

ClaimsPrincipal

claimsPrincipal

Context

context

ContextId

contextId or, if contextId is null, a generated unique ID.

EndpointId

endpointId

Id

Set to a generated unique ID.

IsPersistent

false

IsReferenceMode

false

KeyEffectiveTime

validFrom

KeyExpirationTime

validFrom plus lifetime.

KeyGeneration

null

SecurityKeys

Contains single element that is either key or, if key is null, a generated 128 bit symmetric key.

System_CAPS_noteNote

The default implementation does not use this property. Signing and encryption keys are dictated by the cookie transforms applied by the SessionSecurityTokenHandler that processes the token.

ValidFrom

validFrom

ValidTo

validFrom plus lifetime.

.NET Framework
Available since 4.5
Return to top
Show: