SessionSecurityToken Constructor (ClaimsPrincipal, TimeSpan)

SessionSecurityToken Constructor (ClaimsPrincipal, TimeSpan)

.NET Framework (current version)
 

Initializes a new instance of the SessionSecurityToken class from the specified principal. The new token is valid from UtcNow through the specified lifetime.

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

public SessionSecurityToken(
	ClaimsPrincipal claimsPrincipal,
	TimeSpan lifetime
)

Parameters

claimsPrincipal
Type: System.Security.Claims.ClaimsPrincipal

The claims principal from which to initialize the token.

lifetime
Type: System.TimeSpan

The period from the current time during which the token is valid. The ValidFrom property will be set to UtcNow and the ValidTo property will be set to ValidFrom plus the period specified by this parameter.

Exception Condition
ArgumentNullException

claimsPrincipal is null.

-or-

The Identities property of claimsPrincipal 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

null

ContextId

Set to a generated unique ID.

EndpointId

String.Empty

Id

Set to a generated unique ID.

IsPersistent

false

IsReferenceMode

false

KeyEffectiveTime

UtcNow

KeyExpirationTime

UtcNow plus lifetime.

KeyGeneration

null

SecurityKeys

Contains 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:
© 2016 Microsoft