Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data PersistAuthManager
- initPersistAuthManager :: SnapletLens b SessionManager -> ConnectionPool -> SnapletInit b (AuthManager b)
- initPersistAuthManager' :: AuthSettings -> SnapletLens b SessionManager -> ConnectionPool -> SnapletInit b (AuthManager b)
- authEntityDefs :: [EntityDef]
- data SnapAuthUser = SnapAuthUser {
- snapAuthUserLogin :: !Text
- snapAuthUserEmail :: !Text
- snapAuthUserPassword :: !Text
- snapAuthUserActivatedAt :: !(Maybe UTCTime)
- snapAuthUserSuspendedAt :: !(Maybe UTCTime)
- snapAuthUserRememberToken :: !(Maybe Text)
- snapAuthUserLoginCount :: !Int
- snapAuthUserFailedLoginCount :: !Int
- snapAuthUserLockedOutUntil :: !(Maybe UTCTime)
- snapAuthUserCurrentLoginAt :: !(Maybe UTCTime)
- snapAuthUserLastLoginAt :: !(Maybe UTCTime)
- snapAuthUserCurrentIp :: !(Maybe Text)
- snapAuthUserLastIp :: !(Maybe Text)
- snapAuthUserCreatedAt :: !UTCTime
- snapAuthUserUpdatedAt :: !UTCTime
- snapAuthUserResetToken :: !(Maybe Text)
- snapAuthUserResetRequestedAt :: !(Maybe UTCTime)
- snapAuthUserRoles :: !String
- snapAuthUserMeta :: !String
- type SnapAuthUserId = Key SnapAuthUser
- migrateAuth :: Migration
- db2au :: Entity SnapAuthUser -> AuthUser
- dbUserSplices :: Monad n => Splices (RuntimeSplice n (Entity SnapAuthUser) -> Splice n)
- userDBKey :: AuthUser -> Maybe SnapAuthUserId
- textPassword :: Password -> Text
Documentation
data PersistAuthManager Source #
Instances
IAuthBackend PersistAuthManager Source # | |
Defined in Snap.Snaplet.Auth.Backends.Persistent save :: PersistAuthManager -> AuthUser -> IO (Either AuthFailure AuthUser) # lookupByUserId :: PersistAuthManager -> UserId -> IO (Maybe AuthUser) # lookupByLogin :: PersistAuthManager -> Text -> IO (Maybe AuthUser) # lookupByEmail :: PersistAuthManager -> Text -> IO (Maybe AuthUser) # lookupByRememberToken :: PersistAuthManager -> Text -> IO (Maybe AuthUser) # destroy :: PersistAuthManager -> AuthUser -> IO () # |
initPersistAuthManager :: SnapletLens b SessionManager -> ConnectionPool -> SnapletInit b (AuthManager b) Source #
Initializer that gets AuthSettings from a config file.
initPersistAuthManager' :: AuthSettings -> SnapletLens b SessionManager -> ConnectionPool -> SnapletInit b (AuthManager b) Source #
Initializer that lets you specify AuthSettings.
authEntityDefs :: [EntityDef] Source #
The list of entity definitions this snaplet exposes. You need them so that you can append to your application's list of entity definitions and perform the migration in one block.
See how this example combined an app's own entity definitions and the auth snaplet's in one migration block:
share [mkMigrate "migrateAll"] $ authEntityDefs ++ $(persistFileWith lowerCaseSettings "schema.txt")
Persistent Auth Data Types
Persistent creates its own data types mirroring the database schema, so we
have to export this extra layer of types and conversion to AuthUser
.
data SnapAuthUser Source #
Instances
type SnapAuthUserId = Key SnapAuthUser Source #
db2au :: Entity SnapAuthUser -> AuthUser Source #
Function to convert a SnapAuthUser
entity into the auth snaplet's
AuthUser
.
dbUserSplices :: Monad n => Splices (RuntimeSplice n (Entity SnapAuthUser) -> Splice n) Source #
Splices for SnapAuthUser
that are equivalent to the ones for
AuthUser
.
textPassword :: Password -> Text Source #