Browse Source

publish muk_session_store - 12.0

pull/32/head
MuK IT GmbH 4 years ago
parent
commit
73179c3b9f
  1. 17
      muk_session_store/README.rst
  2. 17
      muk_session_store/doc/index.rst
  3. 8
      muk_session_store/store/redis.py

17
muk_session_store/README.rst

@ -119,12 +119,29 @@ The following fields can be modified in the config file:
* session_store_port
* session_store_dbindex
* session_store_pass
* session_store_ssl
* session_store_ssl_cert_reqs
Usage
=============
After setting the parameters, the session store is used automatically.
In order to use ssl, which is a requirement of some databases, session_store_ssl
should be set to True and session_store_ssl_cert_reqs should be set to 'required'
except in the case where the server certificate does not match the host name.
e.g.
# Server has a proper certificate
session_store_ssl=True
session_store_ssl_cert_reqs=required
# Server does not have a proper certificate (AWS possibly)
session_store_ssl=True
session_store_ssl_cert_reqs=None
For more information please see the redis python module documentation.
Credits
=======

17
muk_session_store/doc/index.rst

@ -119,12 +119,29 @@ The following fields can be modified in the config file:
* session_store_port
* session_store_dbindex
* session_store_pass
* session_store_ssl
* session_store_ssl_cert_reqs
Usage
=============
After setting the parameters, the session store is used automatically.
In order to use ssl, which is a requirement of some databases, session_store_ssl
should be set to True and session_store_ssl_cert_reqs should be set to 'required'
except in the case where the server certificate does not match the host name.
e.g.
# Server has a proper certificate
session_store_ssl=True
session_store_ssl_cert_reqs=required
# Server does not have a proper certificate (AWS possibly)
session_store_ssl=True
session_store_ssl_cert_reqs=None
For more information please see the redis python module documentation.
Credits
=======

8
muk_session_store/store/redis.py

@ -38,6 +38,7 @@ except ImportError:
SESSION_TIMEOUT = 60 * 60 * 24 * 7
def retry_redis(func):
@functools.wraps(func)
def wrapper(self, *args, **kwargs):
@ -48,8 +49,10 @@ def retry_redis(func):
_logger.warn("SessionStore connection failed! (%s/5)" % attempts)
if attempts >= 5:
raise error
return wrapper
class RedisSessionStore(SessionStore):
def __init__(self, *args, **kwargs):
@ -59,7 +62,9 @@ class RedisSessionStore(SessionStore):
host=config.get('session_store_host', 'localhost'),
port=int(config.get('session_store_port', 6379)),
db=int(config.get('session_store_dbindex', 1)),
password=config.get('session_store_pass', None)
password=config.get('session_store_pass', None),
ssl=config.get("session_store_ssl", False),
ssl_cert_reqs=config.get("session_store_ssl_cert_reqs", None),
)
def _encode_session_key(self, key):
@ -89,3 +94,4 @@ class RedisSessionStore(SessionStore):
return self.session_class(pickle.loads(payload), sid, False)
else:
return self.session_class({}, sid, False)
Loading…
Cancel
Save