package sihl
The modular functional web framework
Install
Dune Dependency
Authors
Maintainers
Sources
sihl-queue-0.1.5.tbz
sha256=bfa7bde9af02bb83d5ca39d54797b05b43317f033d93d24ca86ca42ff8ef83a1
sha512=6bb8727f65116e8042aa1fb77b3c14851ce5238f7b412adadf0f8e5b52d5310e8f06056c96bf76a82ffd7096753f49b2b0482f41e18ee1ca94310b874fe81bf9
doc/src/sihl.authn/service.ml.html
Source file service.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
open Lwt.Syntax exception Exception of string module Make (SessionService : Session.Sig.SERVICE) (UserService : User.Sig.SERVICE) : Sig.SERVICE = struct let find_user_in_session_opt ctx = let* user_id = SessionService.get ctx ~key:"authn" in match user_id with | None -> Lwt.return None | Some user_id -> UserService.find_opt ctx ~user_id ;; let find_user_in_session ctx = let* user_id = SessionService.get ctx ~key:"authn" in match user_id with | None -> raise @@ Exception "No user found in current session" | Some user_id -> UserService.find ctx ~user_id ;; let authenticate_session ctx user = SessionService.set ctx ~key:"authn" ~value:(User.id user) ;; let unauthenticate_session ctx = SessionService.unset ctx ~key:"authn" let start ctx = Lwt.return ctx let stop _ = Lwt.return () let lifecycle = Core.Container.Lifecycle.create "authn" ~start ~stop ~dependencies:[ SessionService.lifecycle; UserService.lifecycle ] ;; let configure configuration = let configuration = Core.Configuration.make configuration in Core.Container.Service.create ~configuration lifecycle ;; end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>