|
|
@ -60,14 +60,28 @@ class SessionCookieMiddleware(MiddlewareMixin):
|
|
|
|
response.set_cookie(pub_key_name, public_key_decode)
|
|
|
|
response.set_cookie(pub_key_name, public_key_decode)
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
@staticmethod
|
|
|
|
def set_session_cooke_prefix(request, response):
|
|
|
|
def set_cookie_session_prefix(request, response):
|
|
|
|
key = settings.SESSION_COOKIE_NAME_PREFIX_KEY
|
|
|
|
key = settings.SESSION_COOKIE_NAME_PREFIX_KEY
|
|
|
|
value = settings.SESSION_COOKIE_NAME_PREFIX
|
|
|
|
value = settings.SESSION_COOKIE_NAME_PREFIX
|
|
|
|
if request.COOKIES.get(key) == value:
|
|
|
|
if request.COOKIES.get(key) == value:
|
|
|
|
return response
|
|
|
|
return response
|
|
|
|
response.set_cookie(key, value)
|
|
|
|
response.set_cookie(key, value)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
|
|
|
|
def set_cookie_session_expire(request, response):
|
|
|
|
|
|
|
|
if not request.session.get('auth_session_expiration_required'):
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
value = 'age'
|
|
|
|
|
|
|
|
if settings.SESSION_EXPIRE_AT_BROWSER_CLOSE_FORCE or \
|
|
|
|
|
|
|
|
not request.session.get('auto_login', False):
|
|
|
|
|
|
|
|
value = 'close'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
age = request.session.get_expiry_age()
|
|
|
|
|
|
|
|
response.set_cookie('jms_session_expire', value, max_age=age)
|
|
|
|
|
|
|
|
request.session.pop('auth_session_expiration_required', None)
|
|
|
|
|
|
|
|
|
|
|
|
def process_response(self, request, response: HttpResponse):
|
|
|
|
def process_response(self, request, response: HttpResponse):
|
|
|
|
self.set_session_cooke_prefix(request, response)
|
|
|
|
self.set_cookie_session_prefix(request, response)
|
|
|
|
self.set_session_cooke_prefix(request, response)
|
|
|
|
self.set_cookie_public_key(request, response)
|
|
|
|
|
|
|
|
self.set_cookie_session_expire(request, response)
|
|
|
|
return response
|
|
|
|
return response
|
|
|
|