forked from data-govt-nz/ckanext-security
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathckanext-security.patch
44 lines (38 loc) · 1.81 KB
/
ckanext-security.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
diff --git a/ckan/config/middleware/flask_app.py b/ckan/config/middleware/flask_app.py
index e69e0e0b4..ff9692443 100644
--- a/ckan/config/middleware/flask_app.py
+++ b/ckan/config/middleware/flask_app.py
@@ -183,7 +183,6 @@ def make_flask_stack(conf):
session_opts['session.data_dir'] = '{data_dir}/sessions'.format(
data_dir=cache_dir)
- app.wsgi_app = SessionMiddleware(app.wsgi_app, session_opts)
app.session_interface = BeakerSessionInterface()
# Add Jinja2 extensions and filters
@@ -320,6 +319,9 @@ def make_flask_stack(conf):
who_parser.remote_user_key
)
+ # Moved as part of ckanext-security patch
+ app = SessionMiddleware(app, session_opts)
+
# Update the main CKAN config object with the Flask specific keys
# that were set here or autogenerated
flask_config_keys = set(flask_app.config.keys()) - set(config.keys())
diff --git a/ckan/config/middleware/pylons_app.py b/ckan/config/middleware/pylons_app.py
index 126fe21f0..6a7bfd61d 100644
--- a/ckan/config/middleware/pylons_app.py
+++ b/ckan/config/middleware/pylons_app.py
@@ -64,7 +64,6 @@ def make_pylons_stack(conf, full_stack=True, static_files=True,
# we want to be able to retrieve the routes middleware to be able to update
# the mapper. We store it in the pylons config to allow this.
config['routes.middleware'] = app
- app = SessionMiddleware(app, config)
app = CacheMiddleware(app, config)
# CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)
@@ -137,6 +136,9 @@ def make_pylons_stack(conf, full_stack=True, static_files=True,
who_parser.remote_user_key
)
+ # Moved as part of ckanext-security patch
+ app = SessionMiddleware(app, config)
+
# Establish the Registry for this application
app = RegistryManager(app, streaming=False)