Copyright | (c) Anton Gushcha 2016 |
---|---|
License | MIT |
Maintainer | ncrashed@gmail.com |
Stability | experimental |
Portability | Portable |
Safe Haskell | None |
Language | Haskell2010 |
- type AuthHandler m = (HasAuthConfig m, MonadError ServantErr m, MonadIO m, HasStorage m)
- class Monad m => HasAuthConfig m where
- require :: AuthHandler m => ByteString -> Maybe a -> m a
- getConfig :: AuthHandler m => m AuthConfig
- getsConfig :: AuthHandler m => (AuthConfig -> a) -> m a
- guard404 :: AuthHandler m => ByteString -> m (Maybe a) -> m a
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
getAuthConfig :: m AuthConfig Source #
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