File tree Expand file tree Collapse file tree 5 files changed +56
-0
lines changed Expand file tree Collapse file tree 5 files changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ def read(filename):
84
84
"plone.schema >= 1.2.1" , # new/fixed json field
85
85
"PyJWT" ,
86
86
"pytz" ,
87
+ "collective.monkeypatcher" ,
87
88
],
88
89
extras_require = {"test" : TEST_REQUIRES },
89
90
entry_points = """
Original file line number Diff line number Diff line change 91
91
<include package =" .deserializer" />
92
92
<include package =" .types" />
93
93
<include package =" .search" />
94
+ <include package =" .pas" />
94
95
95
96
<include package =" .upgrades" />
96
97
Original file line number Diff line number Diff line change
1
+ """
2
+ A JWT token authentication plugin for PluggableAuthService.
3
+ """
4
+
5
+ from App import Management
6
+ from Products import PluggableAuthService # noqa, Ensure PAS patch in place
7
+
8
+
9
+ _orig_manage_zmi_logout = Management .Navigation .manage_zmi_logout
10
+
11
+
12
+ # BBB: Maybe remove depending on the outcome of the PAS issue:
13
+ # https://github.com/zopefoundation/Products.PluggableAuthService/issues/107#issue-1090137890
14
+ def manage_zmi_logout (self , REQUEST , RESPONSE ):
15
+ """
16
+ Logout the current ZMI user without re-challenging for login credentials.
17
+ """
18
+ _orig_manage_zmi_logout (self , REQUEST , RESPONSE )
19
+
20
+ # Undo the HTTP `Authorization: Basic ...` assumptions
21
+ RESPONSE .deleteHeader ("WWW-Authenticate" )
22
+ RESPONSE .setStatus (200 )
Original file line number Diff line number Diff line change
1
+ <configure
2
+ xmlns =" http://namespaces.zope.org/zope"
3
+ xmlns : monkey =" http://namespaces.plone.org/monkey"
4
+ xmlns : zcml =" http://namespaces.zope.org/zcml"
5
+ i18n_domain =" plone.volto"
6
+ >
7
+
8
+ <include package =" collective.monkeypatcher" />
9
+
10
+ <monkey : patch
11
+ original =" manage_zmi_logout"
12
+ replacement =" .manage_zmi_logout"
13
+ class =" App.Management.Navigation"
14
+ description =" Patch ZMI logout to remove Basic auth assumptions"
15
+ />
16
+
17
+ </configure >
Original file line number Diff line number Diff line change @@ -382,6 +382,21 @@ def test_root_zmi_logout_expires_api_token(self):
382
382
logout_link = browser .getLink (url = "manage_zmi_logout" )
383
383
logout_link .click ()
384
384
browser .raiseHttpErrors = True
385
+ self .assertEqual (
386
+ browser .headers ["Status" ].lower (),
387
+ "200 ok" ,
388
+ "Wrong Zope root `/acl_users` logout response status" ,
389
+ )
390
+ self .assertEqual (
391
+ browser .url ,
392
+ self .app .absolute_url () + "/manage_zmi_logout" ,
393
+ "Wrong Zope root `/acl_users` logout response URL" ,
394
+ )
395
+ self .assertIn (
396
+ "You have been logged out" ,
397
+ browser .contents ,
398
+ "Zope root `/acl_users` logout response missing confirmation message" ,
399
+ )
385
400
self .assertNotIn (
386
401
"__ac" ,
387
402
browser .cookies ,
You can’t perform that action at this time.
0 commit comments