databrary-1: Databrary

Safe HaskellNone
LanguageHaskell2010

Model.Identity

Synopsis

Documentation

determineIdentity :: (MonadHas Secret c m, MonadHasRequest c m, MonadDB c m) => m Identity Source #

Extract session token from cookie, and use it to find an active session.

This is web framework code, and should NOT be used within application logic.

TODO: Make this more plain, taking the Secret and Request (or just the cookies) as regular arguments.

maybeIdentity Source #

Arguments

:: MonadHasIdentity c m 
=> m a

Default action

-> (Session -> m a)

Monadic function

-> m a

Result

Takes default action and a monadic function. If the Identity within the monadic context is Identified, apply the function to the Session held within. Otherwise, run the default action.