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
681b9a5e
Commit
681b9a5e
authored
Apr 29, 2015
by
Carson Gee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove anonymous caching when SSL is enabled
parent
372e52bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
common/djangoapps/external_auth/tests/test_ssl.py
+4
-0
common/djangoapps/util/cache.py
+9
-1
No files found.
common/djangoapps/external_auth/tests/test_ssl.py
View file @
681b9a5e
...
...
@@ -2,6 +2,7 @@
Provides unit tests for SSL based authentication portions
of the external_auth app.
"""
import
copy
import
unittest
from
django.conf
import
settings
...
...
@@ -31,9 +32,12 @@ FEATURES_WITH_SSL_AUTH_AUTO_ACTIVATE = FEATURES_WITH_SSL_AUTH_IMMEDIATE_SIGNUP.c
FEATURES_WITH_SSL_AUTH_AUTO_ACTIVATE
[
'BYPASS_ACTIVATION_EMAIL_FOR_EXTAUTH'
]
=
True
FEATURES_WITHOUT_SSL_AUTH
=
settings
.
FEATURES
.
copy
()
FEATURES_WITHOUT_SSL_AUTH
[
'AUTH_USE_CERTIFICATES'
]
=
False
CACHES_ENABLE_GENERAL
=
copy
.
deepcopy
(
settings
.
CACHES
)
CACHES_ENABLE_GENERAL
[
'general'
][
'BACKEND'
]
=
'django.core.cache.backends.locmem.LocMemCache'
@override_settings
(
FEATURES
=
FEATURES_WITH_SSL_AUTH
)
@override_settings
(
CACHES
=
CACHES_ENABLE_GENERAL
)
class
SSLClientTest
(
ModuleStoreTestCase
):
"""
Tests SSL Authentication code sections of external_auth
...
...
common/djangoapps/util/cache.py
View file @
681b9a5e
...
...
@@ -8,6 +8,7 @@ not migrating so as not to inconvenience users by logging them all out.
import
urllib
from
functools
import
wraps
from
django.conf
import
settings
from
django.core
import
cache
...
...
@@ -49,7 +50,14 @@ def cache_if_anonymous(*get_parameters):
@wraps
(
view_func
)
def
wrapper
(
request
,
*
args
,
**
kwargs
):
"""The inner wrapper, which wraps the view function."""
if
not
request
.
user
.
is_authenticated
():
# Certificate authentication uses anonymous pages,
# specifically the branding index, to do authentication.
# If that page is cached the authentication doesn't
# happen, so we disable the cache when that feature is enabled.
if
(
not
request
.
user
.
is_authenticated
()
and
not
settings
.
FEATURES
[
'AUTH_USE_CERTIFICATES'
]
):
# Use the cache. The same view accessed through different domain names may
# return different things, so include the domain name in the key.
domain
=
str
(
request
.
META
.
get
(
'HTTP_HOST'
))
+
'.'
...
...
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