| Safe Haskell | Trustworthy |
|---|
Hails.HttpServer.Auth
Description
This module exports generic definitions for Wai-authentication pipelines
in Hails. requireLoginMiddleware looks for the X-Hails-Login
header from an Application 's Response and, if present, responds to
the user with an authentication request instead of the Application
response (e.g., a redirect to a login page or an HTTP response with
status 401).
Additionally, this module exports authentication Middlewares for basic HTTP
authentication, devBasicAuth, (useful in development environments)
and federated (OpenID) authentication, openIdAuth. In general,
authentication Middlewares are expected to set the X-Hails-User
header on the request if it is from an authenticated user.
Documentation
requireLoginMiddleware :: ResourceT IO Response -> MiddlewareSource
Executes the app and if the app Response has header
X-Hails-Login and the user is not logged in, respond with an
authentication response (Basic Auth, redirect, etc.)
Production: OpenID
Development: basic authentication
devBasicAuth :: MiddlewareSource
Basic HTTP authentication middleware for development. Accepts any username and password.