Router.Make
Make
creates an instance of Router with all its dependencies
module M : Auth_sign.MODEL
module A : Auth_sign.AUTHENTICATOR with type entity = M.t
module V : Auth_sign.VARIABLES
type entity = M.t
type entity
is a type of authenticatable entity equal to MODEL
.t
type strategy = (module Auth_sign.STRATEGY with type entity = entity)
strategy
is a function that authenticates an entity from a request.
val login_handler :
strategy Base.list ->
(module Auth_sign.RESPONSES) ->
Dream.request ->
Dream.response Lwt.t
login_handler
gets strats and redponses, starts authentication and handles its results
val logout_handler :
(module Auth_sign.RESPONSES) ->
Dream.request ->
Dream.response Lwt.t
logout_handler
loguts authenticated user
val call :
?root:Base.string ->
responses:(module Auth_sign.RESPONSES) ->
extractor:Static.Params.extractor ->
strategy Base.list ->
Dream.route
call ?root ~responses ~extractor strat_list
creates routes for authentication and added to Dream.router
.
Has some basic routes:
strategies
in order they were supplied in Auth_sign.AUTHENTICATOR.authenticate
. Handles the results and calls corresponding handlers from Auth_sign.RESPONSES
.Authenticator
.logout and responses with Auth_sign.RESPONSES.logout
extractor
defines how to extract params from requests for basic routes. See Static.Params.extractor
.
responses
define how to respond on these basic routes after handling authentication processes.
?root
defines the root for all authentication-related routes. Default is "/".