Эх сурвалжийг харах

HUE-7006 [core] Ability in HUE to change Cookie name from default
"sessionid"

Ying Chen 8 жил өмнө
parent
commit
4c899c4

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

@@ -591,6 +591,10 @@
   # For more info, see https://docs.djangoproject.com/en/1.4/topics/http/sessions/
   # ------------------------------------------------------------------------
   [[session]]
+    # The name of the cookie to use for sessions.
+    # This can have any value that is not used by the other cookie names in your application.
+    ## cookie_name=sessionid
+
     # The cookie containing the users' session ID will expire after this amount of time in seconds.
     # Default is 2 weeks.
     ## ttl=1209600

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

@@ -593,6 +593,10 @@
   # For more info, see https://docs.djangoproject.com/en/1.4/topics/http/sessions/
   # ------------------------------------------------------------------------
   [[session]]
+    # The name of the cookie to use for sessions.
+    # This can have any value that is not used by the other cookie names in your application.
+    ## cookie_name=sessionid
+
     # The cookie containing the users' session ID will expire after this amount of time in seconds.
     # Default is 2 weeks.
     ## ttl=1209600

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

@@ -684,6 +684,13 @@ SESSION = ConfigSection(
   help=_("""Configuration options for specifying the Desktop session.
           For more info, see https://docs.djangoproject.com/en/1.4/topics/http/sessions/"""),
   members=dict(
+    COOKIE_NAME=Config(
+      key='cookie_name',
+      help=_("The name of the cookie to use for sessions."
+            "This can have any value that is not used by the other cookie names in your application."),
+      type=str,
+      default="sessionid",
+    ),
     TTL=Config(
       key='ttl',
       help=_("The cookie containing the users' session ID will expire after this amount of time in seconds."),

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

@@ -346,6 +346,7 @@ CACHES = {
 }
 
 # Configure sessions
+SESSION_COOKIE_NAME = desktop.conf.SESSION.COOKIE_NAME.get()
 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()