servant-auth-token-leveldb 0.4.1.0 → 0.4.1.1
raw patch · 3 files changed
+9/−59 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- README.md +3/−58
- servant-auth-token-leveldb.cabal +1/−1
CHANGELOG.md view
@@ -1,3 +1,8 @@+0.4.1.1+=======++* Documentation fix.+ 0.4.1.0 =======
README.md view
@@ -1,60 +1,5 @@-# servant-auth-token-acid--Storage backend on acid for [servant-auth-token](https://github.com/NCrashed/servant-auth-token) server.--As `acid-state` is bad at composing states, the integration of the library in your project requires a massive TH mixins.-The authentification state's queries are simply copied to your app.--First, define you own global `acid-state` type:--``` haskell-import Data.SafeCopy-import Servant.Server.Auth.Token.Acid.Schema as A---- | Application global state for acid-state-data DB = DB {- dbAuth :: A.Model -- ^ Storage for Auth state-, dbCustom :: () -- ^ Demo of custom state-}---- | Generation of inital state-newDB :: DB-newDB = DB {- dbAuth = A.newModel- , dbCustom = ()- }---- | Extraction of Auth model from global state-instance HasModelRead DB where- askModel = dbAuth---- | Extraction of Auth model from global state-instance HasModelWrite DB where- putModel db m = db { dbAuth = m }--deriveSafeCopy 0 'base ''DB---- Mixin auth state queries and derive acid-state instances for them-A.deriveQueries ''DB-A.makeModelAcidic ''DB-```--Next, define your monad stack for the authorization actions:-``` haskell--- Derive HasStorage for 'AcidBackendT' with your 'DB'.--- It is important that it is come before the below newtype-deriveAcidHasStorage ''DB---- | Special monad for authorisation actions-newtype AuthM a = AuthM { unAuthM :: AcidBackendT DB IO a }- deriving (Functor, Applicative, Monad, MonadIO, MonadError ServantErr, HasAuthConfig, HasStorage)+# servant-auth-token-leveldb --- | Execution of authorisation actions that require 'AuthHandler' context-runAuth :: AuthM a -> ServerM a-runAuth m = do- cfg <- asks envAuthConfig- db <- asks envDB- liftHandler $ ExceptT $ runAcidBackendT cfg db $ unAuthM m-```+Storage backend for [LevelDB](https://github.com/google/leveldb) for [servant-auth-token](https://github.com/NCrashed/servant-auth-token) server. -See a full example in [servant-auth-token-example-acid](https://github.com/NCrashed/servant-auth-token/tree/master/example/acid).+See a full example in [servant-auth-token-example-leveldb](https://github.com/NCrashed/servant-auth-token/tree/master/example/leveldb).
servant-auth-token-leveldb.cabal view
@@ -1,5 +1,5 @@ name: servant-auth-token-leveldb-version: 0.4.1.0+version: 0.4.1.1 synopsis: Leveldb backend for servant-auth-token server description: Please see README.md homepage: https://github.com/ncrashed/servant-auth-token#readme