flaw-network-0.1.0.0

LicenseMIT
Safe HaskellNone
LanguageHaskell2010

Flaw.Network.Session

Description

 
Synopsis

Documentation

data SessionManager uid Source #

Session manager handles user sessions. User authentication is usually rather expensive, as it involves DB access and/or accessing external means such as OAuth requests. Once user authenticity is established (and persistent user id is known), user session can be created and used for the following authentication attempts.

newtype SessionId Source #

Session id.

Constructors

SessionId ByteString 
Instances
Eq SessionId Source # 
Instance details

Defined in Flaw.Network.Session

Show SessionId Source # 
Instance details

Defined in Flaw.Network.Session

Serialize SessionId Source # 
Instance details

Defined in Flaw.Network.Session

Hashable SessionId Source # 
Instance details

Defined in Flaw.Network.Session

data Session uid Source #

Session.

Constructors

Session 

Fields

newSessionManager :: IO (SessionManager uid, IO ()) Source #

Initialize session manager.

newSession :: (Eq uid, Hashable uid) => SessionManager uid -> uid -> STM (Session uid) Source #

Create session for a user. Removes any existing user's session.

getSession :: SessionManager uid -> SessionId -> STM (Maybe (Session uid)) Source #

Try to get session by session id.

deleteSession :: (Eq uid, Hashable uid) => SessionManager uid -> Session uid -> STM () Source #

Delete session.

ensureActiveSession :: Session uid -> STM () Source #

Ensure session is active during current STM transaction. Throws InactiveSessionException if it's not.