Module Sig.Web
val user_from_token : ?ctx:(string * string) list -> ?key:string -> (?ctx:(string * string) list -> string -> k:string -> string option Lwt.t) -> Rock.Request.t -> t option Lwt.t
user_from_token ?ctx ?key read_token request
returns the user that is associated to the user id in theBearer
token of therequest
.key
is the key in the token associated with the user id. By default, the value isuser_id
.read_token
is a function that returns the associated value ofkey
in a given token.
val user_from_session : ?ctx:(string * string) list -> ?cookie_key:string -> ?secret:string -> ?key:string -> Rock.Request.t -> t option Lwt.t
user_from_session ?ctx ?cookie_key ?secret ?key ?secret request
returns the user that is associated to the user id in the session of therequest
.cookie_key
is the name/key of the session cookie. By default, the value is_session
.secret
is used to verify the signature of the session cookie. By default,SIHL_SECRET
is used.key
is the key in the session associated with the user id. By default, the value isuser_id
.