FPauth - user authentication for Dream

Coverage Status

FPauth is an easy user authentication system for OCaml Dream web-framework. FPauth code example

The main idea behind the system is that user authentication is done via running sets of Strategies, and when one of them succeeds, user is considered to be authenticated. Authentication status is controlled by a middleware standing downstream of session middleware.

The system allows to:

Docs can be found here.

Quick setup

In order to start using FPauth, in your project you should:

module Auth = FPauth.Make_Auth (User)
module Password = FPauth_strategies.Password.Make (User)
let () = run
  @@ memory_sessions
  @@ Auth.Session_manager.auth_setup
  @@ router [
      Auth.Router.call [(module Password)] ~responses:(module Responses) ~extractor:extractor ~scope:"/authentication"
  ]

Strategies and Responses modules are passed as first-class objects which suffice FPauth.Auth_sign.STRATEGY and FPauth.Auth_sign.RESPONSES signatures correspondingly. Extractor is a function which meets FPauth.Static.Params.extractor type.

Advanced Usage

It is possible to customize many aspects of the system workflow.