Authentication backend using HDBC
- initHdbcAuthManager :: IConnection conn => AuthSettings -> Lens b (Snaplet SessionManager) -> IO conn -> AuthTable -> Queries -> SnapletInit b (AuthManager b)
- initHdbcAuthManager' :: IConnection conn => AuthSettings -> Lens b (Snaplet SessionManager) -> IO (Pool conn) -> AuthTable -> Queries -> SnapletInit b (AuthManager b)
- data HdbcAuthManager = forall conn . IConnection conn => HdbcAuthManager {}
- data AuthTable = AuthTable {
- tblName :: String
- colId :: String
- colLogin :: String
- colPassword :: String
- colActivatedAt :: String
- colSuspendedAt :: String
- colRememberToken :: String
- colLoginCount :: String
- colFailedLoginCount :: String
- colLockedOutUntil :: String
- colCurrentLoginAt :: String
- colLastLoginAt :: String
- colCurrentLoginIp :: String
- colLastLoginIp :: String
- colCreatedAt :: String
- colUpdatedAt :: String
- colRoles :: String
- colMeta :: String
- defAuthTable :: AuthTable
- colLst :: [AuthTable -> String]
- data LookupQuery
- = ByUserId
- | ByLogin
- | ByRememberToken
- data Queries = Queries {}
- defQueries :: Queries
- defSelectQuery :: AuthTable -> LookupQuery -> [SqlValue] -> (String, [SqlValue])
- defSaveQuery :: AuthTable -> AuthUser -> (String, String, [SqlValue])
- defDeleteQuery :: AuthTable -> AuthUser -> (String, [SqlValue])
- prepExec :: IConnection conn => conn -> String -> [SqlValue] -> IO ()
- authQuery :: HdbcAuthManager -> (String, [SqlValue]) -> IO (Maybe AuthUser)
- mkUser :: AuthTable -> Map String SqlValue -> AuthUser
Documentation
:: IConnection conn | |
=> AuthSettings | Auth settings |
-> Lens b (Snaplet SessionManager) | Lens to the session manager |
-> IO conn | Raw HDBC connection |
-> AuthTable | Authentication table configuration |
-> Queries | Queries to be used for authentication |
-> SnapletInit b (AuthManager b) |
Initialises this HDBC snaplet. It automatically configures a resource
pool with commonly acceptable default settings. Use initHdbcAuthManager'
to initialise with a custom resource pool.
:: IConnection conn | |
=> AuthSettings | Auth settings |
-> Lens b (Snaplet SessionManager) | Lens to the session manager |
-> IO (Pool conn) | A pre-configured resource pool which dispenses HDBC connections |
-> AuthTable | Authentication table configuration |
-> Queries | Queries to be used for authentication |
-> SnapletInit b (AuthManager b) |
Initialises this HDBC snaplet with a custom resource pool.
data HdbcAuthManager Source
Authmanager state containing the resource pool and the table/query configuration.
forall conn . IConnection conn => HdbcAuthManager | |
Datatype containing the names of the columns for the authentication table.
AuthTable | |
|
defAuthTable :: AuthTableSource
Default authentication table layout
colLst :: [AuthTable -> String]Source
List of deconstructors so it's easier to extract column names form an
AuthTable
.
defSelectQuery :: AuthTable -> LookupQuery -> [SqlValue] -> (String, [SqlValue])Source