Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
val user_from_token :
?ctx:(string * string) list ->
?key:string ->
(?ctx:(string * string) list -> string -> k:string -> string option Lwt.t) ->
Rock.Request.t ->
Sihl__.Contract_user.t option Lwt.t
user_from_token ?ctx ?key read_token request
returns the user that is associated to the user id in the Bearer
token of the request
.
key
is the key in the token associated with the user id. By default, the value is user_id
.
read_token
is a function that returns the associated value of key
in a given token.
val user_from_session :
?ctx:(string * string) list ->
?cookie_key:string ->
?secret:string ->
?key:string ->
Rock.Request.t ->
Sihl__.Contract_user.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 the request
.
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 is user_id
.