databrary-1: Databrary

Safe HaskellNone
LanguageHaskell2010

Model.Token

Synopsis

Documentation

lookupLoginToken :: (MonadDB c m, MonadHas Secret c m) => Id LoginToken -> m (Maybe LoginToken) Source #

Attempt to find the matching one time login token for newly registered accounts, so that the user can view the password entry form as well as perform the password update. Retrieve the site auth with access deduced from inherited authorizations. Wrap the site auth in an AccountToken with the corresponding public token value and expiration. Wrap the AccountToken in a LoginToken with a boolean indicating ???? . Seems to be always true.

createLoginToken :: (MonadHas Entropy c m, MonadDB c m) => SiteAuth -> Bool -> m LoginToken Source #

Delete any prior login token that was generated for this account, then generate a new login token. Used when generating the login token for reset password email. paswd will always be True.

lookupSession :: MonadDB c m => ByteString -> m (Maybe Session) Source #

Guts of loading a user and its authorizations during each request, when receiving a logged in session token. Find the active session in the sessions table. Join the session account with its party and account information. Join the party with the authorization it has been granted on the databrary site (party 0), if any. Ultimately, a Session object will be created with an access object built up from the user's effective, inherited permissions on the databrary site (party 0). Note that whenever lookupSession is called, we will be in a bootstrap phase of request handling, where the application hasn't attach an identity (MonadHasIdentity) to the context of actions yet.

cleanTokens :: (MonadDB c m, MonadStorage c m) => m () Source #