C# Class WebChat.Services.UserSessionUtilities.UserSessionManager

Datei anzeigen Open project: SoftUniTeamWork/WebServicesAndCloudTeamProject Class Usage Examples

Public Methods

Method Description
CreateUserSession ( string username, string authToken ) : void

Extends the validity period of the current user's session in the database. This will configure the user's bearer authorization token to expire after certain period of time (e.g. 30 minutes, see UserSessionTimeout in Web.config)

DeleteExpiredSessions ( ) : void
InvalidateUserSession ( ) : void

Makes the current user session invalid (deletes the session token from the user sessions). The goal is to revoke any further access with the same authorization bearer token. Typically this method is called at "logout".

ReValidateSession ( ) : bool

Re-validates the user session. Usually called at each authorization request. If the session is not expired, extends it lifetime and returns true. If the session is expired or does not exist, return false.

UserSessionManager ( IOwinContext context ) : System
UserSessionManager ( IWebChatData data, IOwinContext context ) : System

Private Methods

Method Description
GetCurrentBearerAuthrorizationToken ( ) : string
GetCurrentUserId ( ) : string

Method Details

CreateUserSession() public method

Extends the validity period of the current user's session in the database. This will configure the user's bearer authorization token to expire after certain period of time (e.g. 30 minutes, see UserSessionTimeout in Web.config)
public CreateUserSession ( string username, string authToken ) : void
username string
authToken string
return void

DeleteExpiredSessions() public method

public DeleteExpiredSessions ( ) : void
return void

InvalidateUserSession() public method

Makes the current user session invalid (deletes the session token from the user sessions). The goal is to revoke any further access with the same authorization bearer token. Typically this method is called at "logout".
public InvalidateUserSession ( ) : void
return void

ReValidateSession() public method

Re-validates the user session. Usually called at each authorization request. If the session is not expired, extends it lifetime and returns true. If the session is expired or does not exist, return false.
public ReValidateSession ( ) : bool
return bool

UserSessionManager() public method

public UserSessionManager ( IOwinContext context ) : System
context IOwinContext
return System

UserSessionManager() public method

public UserSessionManager ( IWebChatData data, IOwinContext context ) : System
data IWebChatData
context IOwinContext
return System