Safe Haskell | None |
---|
- type AuthRouter r = Routeable r => (Request -> ByteString -> ByteString -> IO (Maybe Request)) -> r -> Route ()
- basicAuthRoute :: String -> AuthRouter r
- authRewriteReq :: Routeable r => AuthRouter r -> (ByteString -> ByteString -> IO Bool) -> r -> Route ()
- basicAuth :: Routeable r => String -> ByteString -> ByteString -> r -> Route ()
Documentation
type AuthRouter r = Routeable r => (Request -> ByteString -> ByteString -> IO (Maybe Request)) -> r -> Route ()Source
An AuthRouter
authenticates a Request
and, if successful, forwards the
Request
to the Routeable
.
basicAuthRoute :: String -> AuthRouter rSource
An AuthRouter
that uses HTTP basic authentication to authenticate a request
in a particular realm.
authRewriteReq :: Routeable r => AuthRouter r -> (ByteString -> ByteString -> IO Bool) -> r -> Route ()Source
Wraps an AuthRouter
to take a simpler authentication function (that just
just takes a username and password, and returns True
or False
). It also
adds an "X-User" header to the Request
with the authenticated user's
name (the first argument to the authentication function).
basicAuth :: Routeable r => String -> ByteString -> ByteString -> r -> Route ()Source