From d3ded5e8832c599531ccd9c17c7cbee8845d60a9 Mon Sep 17 00:00:00 2001 From: Luca Favini Date: Fri, 19 Apr 2024 23:56:11 +0200 Subject: [PATCH] Expose more optional parameters for setting web session --- sihl/src/web_session.ml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sihl/src/web_session.ml b/sihl/src/web_session.ml index ee8725ce..0f243936 100644 --- a/sihl/src/web_session.ml +++ b/sihl/src/web_session.ml @@ -63,6 +63,11 @@ let get_all let set ?(cookie_key = "_session") ?(secret = Core_configuration.read_secret ()) + ?(expires = `Session) + ?(scope = Uri.of_string "/") + ?(same_site = `Lax) + ?(secure = false) + ?(http_only = false) session resp = @@ -71,7 +76,11 @@ let set let cookie_value = Session.to_json session in let cookie = cookie_key, cookie_value in Opium.Response.add_cookie_or_replace - ~scope:(Uri.of_string "/") + ~expires:expires + ~scope:scope + ~same_site:same_site + ~secure:secure + ~http_only:http_only ~sign_with:signed_with cookie resp