WSFederationAuthenticationModule.SetPrincipalAndWriteSessionToken Method (SessionSecurityToken, Boolean)

.NET Framework (current version)
 

Sets the thread principal and optionally writes the session cookie.

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

public void SetPrincipalAndWriteSessionToken(
	SessionSecurityToken sessionToken,
	bool isSession
)

Parameters

sessionToken
Type: System.IdentityModel.Tokens.SessionSecurityToken

The session security token that was created from the WS-Federation sign-in response message from the STS.

isSession
Type: System.Boolean

true to write a cookie that represents the session included with the response; otherwise, false.

Exception Condition
ArgumentNullException

sessionToken is null.

Called from the request processing pipeline implemented in the OnAuthenticateRequest event-handler delegate. This method does the following:

  1. Invokes the OnSessionSecurityTokenCreated method to raise the SessionSecurityTokenCreated event. You can use this event to modify the session token before it is used to set the thread principal and written to the session cookie and to specify whether the session cookie should be written.

  2. Invokes the AuthenticateSessionSecurityToken method on the configured session authentication module (SessionAuthenticationModule) to set the thread principal and optionally write the session cookie.

.NET Framework
Available since 4.5
Return to top
Show: