servant-auth-token-0.4.7.1: 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

:: HasStorage m 
=> UserImplId

Id of user

-> SingleUseCode

Single usage code

-> Maybe UTCTime

Time when the code expires, Nothing is never expiring code

-> m () 

Register single use code in DB

invalidateSingleUseCode Source #

Arguments

:: HasStorage m 
=> UserSingleUseCodeId

Id of code

-> m () 

Marks single use code that it cannot be used again

validateSingleUseCode Source #

Arguments

:: HasStorage m 
=> UserImplId

Id of user

-> SingleUseCode

Single usage code

-> m Bool 

Check single use code and return True on success.

On success invalidates single use code.

generateSingleUsedCodes Source #

Arguments

:: HasStorage m 
=> UserImplId

Id of user

-> IO SingleUseCode

Generator of codes

-> Word 
-> m [SingleUseCode] 

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

Note: previous codes without expiration are invalidated.