a little cleaning
This commit is contained in:
parent
e069bde130
commit
9e925816e4
2 changed files with 13 additions and 6 deletions
|
@ -47,6 +47,7 @@ import Types.Reader
|
|||
|
||||
import Model.User
|
||||
|
||||
|
||||
initToken :: PGS.Query
|
||||
initToken = "create table if not exists \"token\" (token_string bytea not null primary key, token_user integer references \"user\"(user_id) not null, token_expiry timestamptz not null)"
|
||||
|
||||
|
@ -67,6 +68,7 @@ tokenTable = table "token" (
|
|||
)
|
||||
)
|
||||
|
||||
|
||||
getUserAuthInfo
|
||||
:: Int
|
||||
-> MateHandler AuthInfo
|
||||
|
@ -99,6 +101,7 @@ getUserAuthInfo ident = do
|
|||
)
|
||||
users
|
||||
|
||||
|
||||
validateToken
|
||||
:: PGS.Connection
|
||||
-> ByteString
|
||||
|
@ -131,6 +134,7 @@ validateToken conn header = do
|
|||
{ errBody = "No valid token found!"
|
||||
}
|
||||
|
||||
|
||||
generateToken
|
||||
:: Ticket
|
||||
-> AuthHash
|
||||
|
@ -164,6 +168,7 @@ generateToken (Ticket _ ident exp) (AuthHash hash) = do
|
|||
else
|
||||
return Denied
|
||||
|
||||
|
||||
insertToken
|
||||
:: Token
|
||||
-> Insert [ByteString]
|
||||
|
@ -180,6 +185,7 @@ insertToken (Token tString tUser tExpiry) = Insert
|
|||
, iOnConflict = Nothing
|
||||
}
|
||||
|
||||
|
||||
deleteToken
|
||||
:: ByteString
|
||||
-> Opaleye.Delete Int64
|
||||
|
@ -213,6 +219,7 @@ newTicket ident = do
|
|||
liftIO $ atomically $ modifyTVar store (\s -> S.insert ticket s)
|
||||
return (AuthTicket rand)
|
||||
|
||||
|
||||
processAuthRequest
|
||||
:: AuthRequest
|
||||
-> MateHandler AuthResult
|
||||
|
|
Loading…
Reference in a new issue