servant-auth-token-0.3.0.0: Servant based API and server for token based authorisation

Copyright(c) Anton Gushcha, 2016
LicenseMIT
Maintainerncrashed@gmail.com
Stabilityexperimental
PortabilityPortable
Safe HaskellNone
LanguageHaskell2010

Servant.Server.Auth.Token.SingleUse

Description

 

Synopsis

Documentation

makeSingleUseExpire Source

Arguments

:: MonadIO m 
=> NominalDiffTime

Duration of code

-> m UTCTime

Time when the code expires

Calculate expire date for single usage code

registerSingleUseCode Source

Arguments

:: MonadIO m 
=> UserImplId

Id of user

-> SingleUseCode

Single usage code

-> Maybe UTCTime

Time when the code expires, Nothing is never expiring code

-> SqlPersistT m () 

Register single use code in DB

invalideSingleUseCode Source

Arguments

:: MonadIO m 
=> UserSingleUseCodeId

Id of code

-> SqlPersistT m () 

Marks single use code that it cannot be used again

validateSingleUseCode Source

Arguments

:: MonadIO m 
=> UserImplId

Id of user

-> SingleUseCode

Single usage code

-> SqlPersistT m Bool 

Check single use code and return True on success.

On success invalidates single use code.

generateSingleUsedCodes Source

Arguments

:: MonadIO m 
=> UserImplId

Id of user

-> IO SingleUseCode

Generator of codes

-> Word 
-> SqlPersistT m [SingleUseCode] 

Generates a set single use codes that doesn't expire.

Note: previous codes without expiration are invalidated.