Authd: authentication by token (useful on page reload).
parent
b6655a0ee0
commit
98a30b6c1d
|
@ -164,6 +164,11 @@ codecSearchUser
|
||||||
{ regex: CAR.optional CA.string
|
{ regex: CAR.optional CA.string
|
||||||
, offset: CAR.optional CA.int })
|
, offset: CAR.optional CA.int })
|
||||||
|
|
||||||
|
{- 13 and 14: these messages are not designed for clients. -}
|
||||||
|
{- 15 -}
|
||||||
|
type AuthByToken = { token :: String }
|
||||||
|
codecAuthByToken ∷ CA.JsonCodec AuthByToken
|
||||||
|
codecAuthByToken = CA.object "AuthByToken" (CAR.record { token: CA.string })
|
||||||
|
|
||||||
{-
|
{-
|
||||||
RESPONSES
|
RESPONSES
|
||||||
|
@ -345,6 +350,7 @@ data RequestMessage
|
||||||
| MkCheckPermission CheckPermission -- 10
|
| MkCheckPermission CheckPermission -- 10
|
||||||
| MkSetPermission SetPermission -- 11
|
| MkSetPermission SetPermission -- 11
|
||||||
| MkSearchUser SearchUser -- 12
|
| MkSearchUser SearchUser -- 12
|
||||||
|
| MkAuthByToken AuthByToken -- 15
|
||||||
|
|
||||||
-- All possible answers from the authentication daemon (authd).
|
-- All possible answers from the authentication daemon (authd).
|
||||||
data AnswerMessage
|
data AnswerMessage
|
||||||
|
@ -395,6 +401,7 @@ encode m = case m of
|
||||||
(MkCheckPermission request) -> get_tuple 10 codecCheckPermission request
|
(MkCheckPermission request) -> get_tuple 10 codecCheckPermission request
|
||||||
(MkSetPermission request) -> get_tuple 11 codecSetPermission request
|
(MkSetPermission request) -> get_tuple 11 codecSetPermission request
|
||||||
(MkSearchUser request) -> get_tuple 12 codecSearchUser request
|
(MkSearchUser request) -> get_tuple 12 codecSearchUser request
|
||||||
|
(MkAuthByToken request) -> get_tuple 15 codecAuthByToken request
|
||||||
where
|
where
|
||||||
get_tuple :: forall a. Int -> CA.JsonCodec a -> a -> Tuple UInt String
|
get_tuple :: forall a. Int -> CA.JsonCodec a -> a -> Tuple UInt String
|
||||||
get_tuple num codec request = Tuple (fromInt num) (J.stringify $ CA.encode codec request)
|
get_tuple num codec request = Tuple (fromInt num) (J.stringify $ CA.encode codec request)
|
||||||
|
|
Loading…
Reference in New Issue