File tree Expand file tree Collapse file tree 5 files changed +59
-1
lines changed
classes/ColdTrick/SAMLSSO
views/default/plugins/saml_sso Expand file tree Collapse file tree 5 files changed +59
-1
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace ColdTrick \SAMLSSO ;
4
+
5
+ use Elgg \Http \ResponseBuilder ;
6
+ use Elgg \Http \OkResponse ;
7
+
8
+ class Logout {
9
+
10
+ /**
11
+ * Disable forced SSO login after a logout
12
+ *
13
+ * @param \Elgg\Hook $hook 'response', 'action:logout'
14
+ *
15
+ * @return null|ResponseBuilder
16
+ */
17
+ public static function disableSso (\Elgg \Hook $ hook ): ?ResponseBuilder {
18
+
19
+ $ response = $ hook ->getValue ();
20
+ if (!$ response instanceof OkResponse) {
21
+ return null ;
22
+ }
23
+
24
+ if (!(bool ) elgg_get_plugin_setting ('disable_sso_on_logout ' , 'saml_sso ' )) {
25
+ return null ;
26
+ }
27
+
28
+ $ forward = $ response ->getForwardURL () ?: elgg_get_site_url ();
29
+ $ forward = elgg_http_add_url_query_elements ($ forward , [
30
+ 'disable_sso ' => 1 ,
31
+ ]);
32
+
33
+ $ response ->setForwardURL ($ forward );
34
+
35
+ return $ response ;
36
+ }
37
+ }
Original file line number Diff line number Diff line change 9
9
],
10
10
'settings ' => [
11
11
'use_http_x_forwarded ' => 0 ,
12
+ 'disable_sso_on_logout ' => false ,
12
13
],
13
14
'entities ' => [
14
15
[
55
56
'menu:page ' => [
56
57
'\ColdTrick\SAMLSSO\Menus::registerAdminPageMenu ' => [],
57
58
],
58
- ]
59
+ ],
60
+ 'response ' => [
61
+ 'action:logout ' => [
62
+ '\ColdTrick\SAMLSSO\Logout::disableSso ' => [],
63
+ ],
64
+ ],
59
65
],
60
66
'actions ' => [
61
67
'saml_sso/add_idp_from_xml ' => [
Original file line number Diff line number Diff line change 6
6
7
7
'saml_sso:settings:use_http_x_forwarded ' => "Use proxy variables " ,
8
8
'saml_sso:settings:use_http_x_forwarded:help ' => "Allow the usage of HTTP_X_FORWARDED server information " ,
9
+ 'saml_sso:settings:disable_sso_on_logout ' => "Disable SSO on logout " ,
10
+ 'saml_sso:settings:disable_sso_on_logout:help ' => "Enabling this will prevent forced SSO for users that explicitely use the logout action " ,
9
11
10
12
'add:object:saml_idp ' => "Create IDP " ,
11
13
'add:object:saml_idp:from_xml ' => "Create IDP from XML " ,
Original file line number Diff line number Diff line change 9
9
'admin:configure_utilities:manage_idps ' => 'Beheer SAML IDPs ' ,
10
10
'saml_sso:settings:use_http_x_forwarded ' => 'Gebruik proxy variabelen ' ,
11
11
'saml_sso:settings:use_http_x_forwarded:help ' => 'Sta het gebruik toe van de HTTP_X_FORWARDED server informatie ' ,
12
+ 'saml_sso:settings:disable_sso_on_logout ' => 'SSO uitschakelen na afmelden ' ,
13
+ 'saml_sso:settings:disable_sso_on_logout:help ' => 'Indien dit actief is zal er geen SSO geforceerd worden wanneer een gebruiker zich expliciet heeft afgemeld ' ,
12
14
'add:object:saml_idp ' => 'Maak IDP ' ,
13
15
'add:object:saml_idp:from_xml ' => 'Maak IDP obv XML ' ,
14
16
'saml_sso:add_from_xml:url ' => 'Voer IDP metadata URL in voor autodetectie ' ,
Original file line number Diff line number Diff line change 16
16
'default ' => 0 ,
17
17
'value ' => 1 ,
18
18
]);
19
+
20
+ echo elgg_view_field ([
21
+ '#type ' => 'checkbox ' ,
22
+ '#label ' => elgg_echo ('saml_sso:settings:disable_sso_on_logout ' ),
23
+ '#help ' => elgg_echo ('saml_sso:settings:disable_sso_on_logout:help ' ),
24
+ 'name ' => 'params[disable_sso_on_logout] ' ,
25
+ 'checked ' => (bool ) $ plugin ->disable_sso_on_logout ,
26
+ 'switch ' => true ,
27
+ 'default ' => 0 ,
28
+ 'value ' => 1 ,
29
+ ]);
You can’t perform that action at this time.
0 commit comments