Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
34863c76
Commit
34863c76
authored
Jun 24, 2015
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the user info cookie secure
parent
5e86a647
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
common/djangoapps/student/cookies.py
+13
-2
No files found.
common/djangoapps/student/cookies.py
View file @
34863c76
...
...
@@ -58,7 +58,6 @@ def set_logged_in_cookies(request, response, user):
'expires'
:
expires
,
'domain'
:
settings
.
SESSION_COOKIE_DOMAIN
,
'path'
:
'/'
,
'secure'
:
None
,
'httponly'
:
None
,
}
...
...
@@ -66,7 +65,7 @@ def set_logged_in_cookies(request, response, user):
# is logged in. This is just a boolean value, so it's not very useful.
# In the future, we should be able to replace this with the "user info"
# cookie set below.
response
.
set_cookie
(
settings
.
EDXMKTG_LOGGED_IN_COOKIE_NAME
,
'true'
,
**
cookie_settings
)
response
.
set_cookie
(
settings
.
EDXMKTG_LOGGED_IN_COOKIE_NAME
,
'true'
,
secure
=
None
,
**
cookie_settings
)
# Set a cookie with user info. This can be used by external sites
# to customize content based on user information. Currently,
...
...
@@ -96,9 +95,21 @@ def set_logged_in_cookies(request, response, user):
'header_urls'
:
header_urls
,
}
# In production, TLS should be enabled so that this cookie is encrypted
# when we send it. We also need to set "secure" to True so that the browser
# will transmit it only over secure connections.
#
# In non-production environments (acceptance tests, devstack, and sandboxes),
# we still want to set this cookie. However, we do NOT want to set it to "secure"
# because the browser won't send it back to us. This can cause an infinite redirect
# loop in the third-party auth flow, which calls `is_logged_in_cookie_set` to determine
# whether it needs to set the cookie or continue to the next pipeline stage.
user_info_cookie_is_secure
=
request
.
is_secure
()
response
.
set_cookie
(
settings
.
EDXMKTG_USER_INFO_COOKIE_NAME
,
json
.
dumps
(
user_info
),
secure
=
user_info_cookie_is_secure
,
**
cookie_settings
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment