SessionAuthenticationModule.CreateSessionSecurityToken Method (ClaimsPrincipal, String, DateTime, DateTime, Boolean)

.NET Framework (current version)
 

Creates a SessionSecurityToken from the specified parameters by using the configured session token handler.

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

public SessionSecurityToken CreateSessionSecurityToken(
	ClaimsPrincipal principal,
	string context,
	DateTime validFrom,
	DateTime validTo,
	bool isPersistent
)

Parameters

principal
Type: System.Security.Claims.ClaimsPrincipal

The principal to be captured in the token.

context
Type: System.String

An application-defined context string.

validFrom
Type: System.DateTime

The first instant in which this token is valid.

validTo
Type: System.DateTime

The last instant in which this token is valid.

isPersistent
Type: System.Boolean

true if the value should be persisted by the user agent; otherwise, false.

Return Value

Type: System.IdentityModel.Tokens.SessionSecurityToken

The session token.

Exception Condition
InvalidOperationException

There is not a valid session token handler configured. (There is no SessionSecurityTokenHandler configured in the SecurityTokenHandlers property.)

.NET Framework
Available since 4.5
Return to top
Show: