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

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

public SessionSecurityToken(
	ClaimsPrincipal claimsPrincipal,
	UniqueId contextId,
	string context,
	string endpointId,
	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.

lifetime
Type: System.TimeSpan

The lifetime of the session token. The ValidFrom property will be set to UtcNow and 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

EndpointId

endpointId

Id

Set to a generated unique ID.

IsPersistent

false

IsReferenceMode

false

KeyEffectiveTime

UtcNow

KeyExpirationTime

UtcNow 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

UtcNow

ValidTo

UtcNow plus lifetime

.NET Framework
Available since 4.5
Return to top
Show: