servant-auth-token-0.4.1.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.Monad

Description

 

Synopsis

Documentation

type AuthHandler m = (HasAuthConfig m, MonadError ServantErr m, MonadIO m, HasStorage m) Source #

Context that is needed to run the auth server

class Monad m => HasAuthConfig m where Source #

Monad that can read an auth config

Minimal complete definition

getAuthConfig

require :: AuthHandler m => ByteString -> Maybe a -> m a Source #

If the value is Nothing, throw 400 response

getConfig :: AuthHandler m => m AuthConfig Source #

Getting config from global state

getsConfig :: AuthHandler m => (AuthConfig -> a) -> m a Source #

Getting config part from global state

guard404 :: AuthHandler m => ByteString -> m (Maybe a) -> m a Source #

Run RDBMS operation and throw 404 (not found) error if the second arg returns Nothing