hails-0.9.2.0: Multi-app web platform framework

Safe HaskellTrustworthy

Hails.HttpServer.Auth

Contents

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.

Synopsis

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

openIdAuthSource

Arguments

:: Text

OpenID Provider

-> Middleware 

Perform OpenID authentication.

Development: basic authentication

devBasicAuth :: MiddlewareSource

Basic HTTP authentication middleware for development. Accepts any username and password.