| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Sun, 18 Jan 2026 20:43:09 GMT
X-Served-By: cache-dfw-kdal2120029-DFW, cache-bom-vanm7210024-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768768990.590170,VS0,VE301
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
servant-auth-token-persistent: Persistent backend for servant-auth-token server
servant-auth-token-persistent: Persistent backend for servant-auth-token server
Downloads
- servant-auth-token-persistent-0.7.0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.4.0.0, 0.5.0.0, 0.5.1.0, 0.5.1.1, 0.6.0.0, 0.6.1.0, 0.6.2.0, 0.6.3.0, 0.7.0.0 |
|---|---|
| Change log | CHANGELOG.md |
| Dependencies | aeson-injector (>=1.0 && <1.2), base (>=4.7 && <5), bytestring (>=0.10 && <0.11), containers (>=0.5 && <0.6), exceptions (>=0.8 && <0.11), mtl (>=2.2 && <2.3), persistent (>=2.2 && <2.9), persistent-template (>=2.1 && <2.7), servant-auth-token (>=0.5 && <0.6), servant-auth-token-api (>=0.5 && <0.6), servant-server (>=0.9 && <0.15), text (>=1.2 && <1.3), time (>=1.5 && <1.9), transformers (>=0.4 && <0.6), unliftio-core (>=0.1 && <0.3), uuid (>=1.3 && <1.4) [details] |
| License | BSD-3-Clause |
| Copyright | 2016 Anton Gushcha |
| Author | NCrashed |
| Maintainer | ncrashed@gmail.com |
| Uploaded | by NCrashed at 2018-09-13T17:40:10Z |
| Category | Web |
| Home page | https://github.com/ncrashed/servant-auth-token#readme |
| Source repo | head: git clone https://github.com/ncrashed/servant-auth-token |
| Distributions | |
| Reverse Dependencies | 1 direct, 0 indirect [details] |
| Downloads | 5225 total (25 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs available [build log] Last success reported on 2018-09-13 [all 1 reports] |
Readme for servant-auth-token-persistent-0.7.0.0
[back to package description]servant-auth-token-persistent
Storage backend on persistent for servant-auth-token server.
An itegration of the backend is simple:
-- | Special monad for authorisation actions
newtype AuthM a = AuthM { unAuthM :: PersistentBackendT IO a }
deriving (Functor, Applicative, Monad, MonadIO, MonadError ServantErr, HasStorage, HasAuthConfig)
-- | Execution of authorisation actions that require 'AuthHandler' context
runAuth :: AuthM a -> ServerM a
runAuth m = do
cfg <- asks envAuthConfig
pool <- asks envPool
liftHandler $ ExceptT $ runPersistentBackendT cfg pool $ unAuthM m
Don't forget to add migration to your server startup (if you actually want automatic migrations):
-- | Create new server environment
newServerEnv :: MonadIO m => ServerConfig -> m ServerEnv
newServerEnv cfg = do
let authConfig = defaultAuthConfig
pool <- liftIO $ do
pool <- createPool cfg
-- run migrations
flip runSqlPool pool $ runMigration S.migrateAllAuth
-- create default admin if missing one
_ <- runPersistentBackendT authConfig pool $ ensureAdmin 17 "admin" "123456" "admin@localhost"
return pool
let env = ServerEnv {
envConfig = cfg
, envAuthConfig = authConfig
, envPool = pool
}
return env
See a full example in servant-auth-token-example-persistent.