happstack-server-7.1.7.1: Web related tools and services.

Safe Haskell | None

Happstack.Server.Auth

Description

Support for basic access authentication http://en.wikipedia.org/wiki/Basic_access_authentication

Synopsis

- basicAuth :: Happstack m => String -> Map String String -> m a -> m a

# Documentation

basicAuth

Arguments

:: Happstack m |
=> String | the realm name
-> Map String String | the username password map
-> m a | the part to guard
-> m a |

A simple HTTP basic authentication guard.

If authentication fails, this part will call `mzero`.

example:

     main = simpleHTTP nullConf $
      msum [ basicAuth "127.0.0.1" (fromList [("happstack","rocks")]) $ ok "You are in the secret club"
           , ok "You are not in the secret club."
           ]