Explorar o código

[core] Provide ini parameter for browser-length cookies

Romain Rigaux %!s(int64=12) %!d(string=hai) anos
pai
achega
2e5e8b7

+ 3 - 0
desktop/conf.dist/hue.ini

@@ -210,6 +210,9 @@
     # The cookie containing the users' session ID will use the HTTP only flag.
     ## http_only=false
 
+    # Use session-length cookies. Logs out the user when she closes the browser window.
+    ## expire_at_browser_close=false
+
 
   # Configuration options for connecting to an external SMTP server
   # ------------------------------------------------------------------------

+ 4 - 0
desktop/conf/pseudo-distributed.ini.tmpl

@@ -216,6 +216,10 @@
     # The cookie containing the users' session ID will use the HTTP only flag.
     ## http_only=false
 
+    # Use session-length cookies. Logs out the user when she closes the browser window.
+    ## expire_at_browser_close=false
+
+
   # Configuration options for connecting to an external SMTP server
   # ------------------------------------------------------------------------
   [[smtp]]

+ 6 - 0
desktop/core/src/desktop/conf.py

@@ -259,6 +259,12 @@ SESSION = ConfigSection(
       help=_("The cookie containing the users' session ID will use the HTTP only flag."),
       type=coerce_bool,
       default=False
+    ),
+    EXPIRE_AT_BROWSER_CLOSE=Config(
+      key='expire_at_browser_close',
+      help=_("Use session-length cookies. Logs out the user when she closes the browser window."),
+      type=coerce_bool,
+      default=False
     )
   )
 )

+ 1 - 0
desktop/core/src/desktop/settings.py

@@ -276,6 +276,7 @@ DATABASES = {
 # Configure sessions
 SESSION_COOKIE_AGE = desktop.conf.SESSION.TTL.get()
 SESSION_COOKIE_SECURE = desktop.conf.SESSION.SECURE.get()
+SESSION_EXPIRE_AT_BROWSER_CLOSE = desktop.conf.SESSION.EXPIRE_AT_BROWSER_CLOSE.get()
 
 # HTTP only
 SESSION_COOKIE_HTTPONLY = desktop.conf.SESSION.HTTP_ONLY.get()