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
03c3ee53
Commit
03c3ee53
authored
Oct 07, 2016
by
Andy Armstrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move cors_crsf to openedx/core
parent
8c22d522
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
35 additions
and
19 deletions
+35
-19
cms/envs/common.py
+1
-0
common/djangoapps/enrollment/views.py
+2
-2
lms/envs/common.py
+4
-3
lms/urls.py
+1
-1
openedx/core/djangoapps/cors_csrf/__init__.py
+0
-0
openedx/core/djangoapps/cors_csrf/admin.py
+6
-2
openedx/core/djangoapps/cors_csrf/authentication.py
+6
-2
openedx/core/djangoapps/cors_csrf/decorators.py
+0
-0
openedx/core/djangoapps/cors_csrf/helpers.py
+0
-0
openedx/core/djangoapps/cors_csrf/middleware.py
+1
-1
openedx/core/djangoapps/cors_csrf/migrations/0001_initial.py
+0
-0
openedx/core/djangoapps/cors_csrf/migrations/__init__.py
+0
-0
openedx/core/djangoapps/cors_csrf/models.py
+4
-1
openedx/core/djangoapps/cors_csrf/templates/cors_csrf/xdomain_proxy.html
+0
-0
openedx/core/djangoapps/cors_csrf/tests/__init__.py
+0
-0
openedx/core/djangoapps/cors_csrf/tests/test_authentication.py
+1
-1
openedx/core/djangoapps/cors_csrf/tests/test_decorators.py
+2
-1
openedx/core/djangoapps/cors_csrf/tests/test_middleware.py
+1
-1
openedx/core/djangoapps/cors_csrf/tests/test_views.py
+4
-3
openedx/core/djangoapps/cors_csrf/views.py
+2
-1
No files found.
cms/envs/common.py
View file @
03c3ee53
...
...
@@ -252,6 +252,7 @@ MAKO_TEMPLATES['main'] = [
COMMON_ROOT
/
'templates'
,
COMMON_ROOT
/
'djangoapps'
/
'pipeline_mako'
/
'templates'
,
COMMON_ROOT
/
'static'
,
# required to statically include common Underscore templates
OPENEDX_ROOT
/
'core'
/
'djangoapps'
/
'cors_csrf'
/
'templates'
,
OPENEDX_ROOT
/
'core'
/
'djangoapps'
/
'dark_lang'
/
'templates'
,
CMS_ROOT
/
'djangoapps'
/
'pipeline_js'
/
'templates'
,
]
...
...
common/djangoapps/enrollment/views.py
View file @
03c3ee53
...
...
@@ -18,8 +18,8 @@ from rest_framework.throttling import UserRateThrottle
from
rest_framework.views
import
APIView
from
opaque_keys.edx.keys
import
CourseKey
from
embargo
import
api
as
embargo_api
from
cors_csrf.authentication
import
SessionAuthenticationCrossDomainCsrf
from
cors_csrf.decorators
import
ensure_csrf_cookie_cross_domain
from
openedx.core.djangoapps.
cors_csrf.authentication
import
SessionAuthenticationCrossDomainCsrf
from
openedx.core.djangoapps.
cors_csrf.decorators
import
ensure_csrf_cookie_cross_domain
from
openedx.core.lib.api.authentication
import
(
SessionAuthenticationAllowInactiveUser
,
OAuth2AuthenticationAllowInactiveUser
,
...
...
lms/envs/common.py
View file @
03c3ee53
...
...
@@ -471,6 +471,7 @@ MAKO_TEMPLATES['main'] = [
COMMON_ROOT
/
'templates'
,
COMMON_ROOT
/
'lib'
/
'capa'
/
'capa'
/
'templates'
,
COMMON_ROOT
/
'djangoapps'
/
'pipeline_mako'
/
'templates'
,
OPENEDX_ROOT
/
'core'
/
'djangoapps'
/
'cors_csrf'
/
'templates'
,
OPENEDX_ROOT
/
'core'
/
'djangoapps'
/
'dark_lang'
/
'templates'
,
]
...
...
@@ -1129,8 +1130,8 @@ MIDDLEWARE_CLASSES = (
# CORS and CSRF
'corsheaders.middleware.CorsMiddleware'
,
'cors_csrf.middleware.CorsCSRFMiddleware'
,
'cors_csrf.middleware.CsrfCrossDomainCookieMiddleware'
,
'
openedx.core.djangoapps.
cors_csrf.middleware.CorsCSRFMiddleware'
,
'
openedx.core.djangoapps.
cors_csrf.middleware.CsrfCrossDomainCookieMiddleware'
,
'django.middleware.csrf.CsrfViewMiddleware'
,
'splash.middleware.SplashMiddleware'
,
...
...
@@ -2072,7 +2073,7 @@ INSTALLED_APPS = (
# CORS and cross-domain CSRF
'corsheaders'
,
'cors_csrf'
,
'
openedx.core.djangoapps.
cors_csrf'
,
'commerce'
,
...
...
lms/urls.py
View file @
03c3ee53
...
...
@@ -884,7 +884,7 @@ urlpatterns += (
# XDomain proxy
urlpatterns
+=
(
url
(
r'^xdomain_proxy.html$'
,
'cors_csrf.views.xdomain_proxy'
,
name
=
'xdomain_proxy'
),
url
(
r'^xdomain_proxy.html$'
,
'
openedx.core.djangoapps.
cors_csrf.views.xdomain_proxy'
,
name
=
'xdomain_proxy'
),
)
# Custom courses on edX (CCX) URLs
...
...
common
/djangoapps/cors_csrf/__init__.py
→
openedx/core
/djangoapps/cors_csrf/__init__.py
View file @
03c3ee53
File moved
common
/djangoapps/cors_csrf/admin.py
→
openedx/core
/djangoapps/cors_csrf/admin.py
View file @
03c3ee53
"""Manage cross-domain configuration. """
"""
Manage cross-domain configuration.
"""
from
django.contrib
import
admin
from
config_models.admin
import
ConfigurationModelAdmin
from
cors_csrf.models
import
XDomainProxyConfiguration
from
.models
import
XDomainProxyConfiguration
admin
.
site
.
register
(
XDomainProxyConfiguration
,
ConfigurationModelAdmin
)
common
/djangoapps/cors_csrf/authentication.py
→
openedx/core
/djangoapps/cors_csrf/authentication.py
View file @
03c3ee53
"""Django Rest Framework Authentication classes for cross-domain end-points."""
"""
Django Rest Framework Authentication classes for cross-domain end-points.
"""
from
rest_framework
import
authentication
from
cors_csrf.helpers
import
is_cross_domain_request_allowed
,
skip_cross_domain_referer_check
from
.helpers
import
is_cross_domain_request_allowed
,
skip_cross_domain_referer_check
class
SessionAuthenticationCrossDomainCsrf
(
authentication
.
SessionAuthentication
):
...
...
common
/djangoapps/cors_csrf/decorators.py
→
openedx/core
/djangoapps/cors_csrf/decorators.py
View file @
03c3ee53
File moved
common
/djangoapps/cors_csrf/helpers.py
→
openedx/core
/djangoapps/cors_csrf/helpers.py
View file @
03c3ee53
File moved
common
/djangoapps/cors_csrf/middleware.py
→
openedx/core
/djangoapps/cors_csrf/middleware.py
View file @
03c3ee53
...
...
@@ -48,7 +48,7 @@ from django.conf import settings
from
django.middleware.csrf
import
CsrfViewMiddleware
from
django.core.exceptions
import
MiddlewareNotUsed
,
ImproperlyConfigured
from
cors_csrf
.helpers
import
is_cross_domain_request_allowed
,
skip_cross_domain_referer_check
from
.helpers
import
is_cross_domain_request_allowed
,
skip_cross_domain_referer_check
log
=
logging
.
getLogger
(
__name__
)
...
...
common
/djangoapps/cors_csrf/migrations/0001_initial.py
→
openedx/core
/djangoapps/cors_csrf/migrations/0001_initial.py
View file @
03c3ee53
File moved
common
/djangoapps/cors_csrf/migrations/__init__.py
→
openedx/core
/djangoapps/cors_csrf/migrations/__init__.py
View file @
03c3ee53
File moved
common
/djangoapps/cors_csrf/models.py
→
openedx/core
/djangoapps/cors_csrf/models.py
View file @
03c3ee53
...
...
@@ -7,7 +7,7 @@ from config_models.models import ConfigurationModel
class
XDomainProxyConfiguration
(
ConfigurationModel
):
"""Cross-domain proxy configuration.
See `cors_csrf.views.xdomain_proxy` for an explanation of how this works.
See `
openedx.core.djangoapps.
cors_csrf.views.xdomain_proxy` for an explanation of how this works.
"""
...
...
@@ -17,3 +17,6 @@ class XDomainProxyConfiguration(ConfigurationModel):
u"requests to this site. Please list each domain on its own line."
)
)
def
__unicode__
(
self
):
return
"XDomainProxyConfiguration()"
common
/templates/cors_csrf/xdomain_proxy.html
→
openedx/core/djangoapps/cors_csrf
/templates/cors_csrf/xdomain_proxy.html
View file @
03c3ee53
File moved
common
/djangoapps/cors_csrf/tests/__init__.py
→
openedx/core
/djangoapps/cors_csrf/tests/__init__.py
View file @
03c3ee53
File moved
common
/djangoapps/cors_csrf/tests/test_authentication.py
→
openedx/core
/djangoapps/cors_csrf/tests/test_authentication.py
View file @
03c3ee53
...
...
@@ -8,7 +8,7 @@ from django.conf import settings
from
rest_framework.exceptions
import
PermissionDenied
from
cors_csrf
.authentication
import
SessionAuthenticationCrossDomainCsrf
from
.
.authentication
import
SessionAuthenticationCrossDomainCsrf
class
CrossDomainAuthTest
(
TestCase
):
...
...
common
/djangoapps/cors_csrf/tests/test_decorators.py
→
openedx/core
/djangoapps/cors_csrf/tests/test_decorators.py
View file @
03c3ee53
...
...
@@ -3,7 +3,8 @@ import json
import
mock
from
django.http
import
HttpResponse
from
django.test
import
TestCase
from
cors_csrf.decorators
import
ensure_csrf_cookie_cross_domain
from
..decorators
import
ensure_csrf_cookie_cross_domain
def
fake_view
(
request
):
...
...
common
/djangoapps/cors_csrf/tests/test_middleware.py
→
openedx/core
/djangoapps/cors_csrf/tests/test_middleware.py
View file @
03c3ee53
...
...
@@ -11,7 +11,7 @@ from django.core.exceptions import MiddlewareNotUsed, ImproperlyConfigured
from
django.http
import
HttpResponse
from
django.middleware.csrf
import
CsrfViewMiddleware
from
cors_csrf
.middleware
import
CorsCSRFMiddleware
,
CsrfCrossDomainCookieMiddleware
from
.
.middleware
import
CorsCSRFMiddleware
,
CsrfCrossDomainCookieMiddleware
SENTINEL
=
object
()
...
...
common
/djangoapps/cors_csrf/tests/test_views.py
→
openedx/core
/djangoapps/cors_csrf/tests/test_views.py
View file @
03c3ee53
"""Tests for cross-domain request views. """
import
ddt
import
json
from
django.test
import
TestCase
from
django.core.urlresolvers
import
reverse
,
NoReverseMatch
import
ddt
from
config_models.models
import
cache
from
cors_csrf.models
import
XDomainProxyConfiguration
from
..models
import
XDomainProxyConfiguration
@ddt.ddt
...
...
common
/djangoapps/cors_csrf/views.py
→
openedx/core
/djangoapps/cors_csrf/views.py
View file @
03c3ee53
...
...
@@ -5,7 +5,8 @@ from django.conf import settings
from
django.views.decorators.cache
import
cache_page
from
django.http
import
HttpResponseNotFound
from
edxmako.shortcuts
import
render_to_response
from
cors_csrf.models
import
XDomainProxyConfiguration
from
.models
import
XDomainProxyConfiguration
log
=
logging
.
getLogger
(
__name__
)
...
...
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