mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 18:37:39 -02:30
Fixing cookie settings for CSRF and auth token
This commit is contained in:
@@ -189,6 +189,9 @@ JOB_EVENT_MAX_QUEUE_SIZE = 10000
|
|||||||
# Disallow sending session cookies over insecure connections
|
# Disallow sending session cookies over insecure connections
|
||||||
SESSION_COOKIE_SECURE = True
|
SESSION_COOKIE_SECURE = True
|
||||||
|
|
||||||
|
# Do not allow non-browser clients to read the CSRF cookie.
|
||||||
|
CSRF_COOKIE_HTTPONLY = True
|
||||||
|
|
||||||
# Disallow sending csrf cookies over insecure connections
|
# Disallow sending csrf cookies over insecure connections
|
||||||
CSRF_COOKIE_SECURE = True
|
CSRF_COOKIE_SECURE = True
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class CompleteView(BaseRedirectView):
|
|||||||
logger.info(smart_text(u"User {} logged in".format(self.request.user.username)))
|
logger.info(smart_text(u"User {} logged in".format(self.request.user.username)))
|
||||||
request.session['auth_token_key'] = token.key
|
request.session['auth_token_key'] = token.key
|
||||||
token_key = urllib.quote('"%s"' % token.key)
|
token_key = urllib.quote('"%s"' % token.key)
|
||||||
response.set_cookie('token', token_key)
|
response.set_cookie('token', value=token_key, httponly=True)
|
||||||
token_expires = token.expires.astimezone(utc).strftime('%Y-%m-%dT%H:%M:%S')
|
token_expires = token.expires.astimezone(utc).strftime('%Y-%m-%dT%H:%M:%S')
|
||||||
token_expires = '%s.%03dZ' % (token_expires, token.expires.microsecond / 1000)
|
token_expires = '%s.%03dZ' % (token_expires, token.expires.microsecond / 1000)
|
||||||
token_expires = urllib.quote('"%s"' % token_expires)
|
token_expires = urllib.quote('"%s"' % token_expires)
|
||||||
|
|||||||
Reference in New Issue
Block a user