Basic authentication protected API
type SubApi = API1 :<|> API2 :<|> API3 type API = BasicAuth "foo-realm" AuthData :> SubApi
supports handlers like AuthData -> Handler a .
I have a set of handlers:
handler1 :: Request1 -> AuthMonad Response handler2 :: Request2 -> AuthMonad Response
Runs in AuthMonad, which is ReaderT, whose context is partially created from AuthData. Using enter and AuthMonad :~> Handler , I can get Server API support handlers like AuthData -> AuthMonad , but I would really like to use the AuthData argument as the environment for runReaderT.
I'm not well-versed in the wizardry type working with enter to figure out how to do this. Any ideas?
source share