| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Web.Simple.Auth
Description
Provides HTTP Basic Authentication.
Synopsis
- type AuthRouter r a = (Request -> ByteString -> ByteString -> Controller r (Maybe Request)) -> Controller r a -> Controller r a
- basicAuthRoute :: String -> AuthRouter r a
- basicAuth :: String -> ByteString -> ByteString -> Controller r a -> Controller r a
- authRewriteReq :: AuthRouter r a -> (ByteString -> ByteString -> Controller r Bool) -> Controller r a -> Controller r a
Documentation
type AuthRouter r a = (Request -> ByteString -> ByteString -> Controller r (Maybe Request)) -> Controller r a -> Controller r a Source #
An AuthRouter authenticates a Request and, if successful, forwards the
Request to the Routeable.
basicAuthRoute :: String -> AuthRouter r a Source #
An AuthRouter that uses HTTP basic authentication to authenticate a request
in a particular realm.
Arguments
| :: String | Realm |
| -> ByteString | Username |
| -> ByteString | Password |
| -> Controller r a | |
| -> Controller r a |
A Route that uses HTTP basic authentication to authenticate a request for a realm
with the given username ans password. The request is rewritten with an 'X-User' header
containing the authenticated username before being passed to the next Route.
authRewriteReq :: AuthRouter r a -> (ByteString -> ByteString -> Controller r Bool) -> Controller r a -> Controller r a 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).