1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wallabag2_ynh.git synced 2024-10-01 13:35:06 +02:00
wallabag2_ynh/sources/patches/app-01-logout-success-handler.patch
JimboJoe 689e47f4c5 Testing (#42)
* Keep optional configuration lines in nginx.conf to allow changing URL from/to "/path" locations
Rename comment prefixes fore more readability

* Add change_url script

* Require YNH 2.7.2, remove helpers and sudo prefixes

* Use ynh_replace_string

* Handle nginx conf file checksums

* Fix indentation

* Update source to 2.3

* Update version to 2.3

* Update readme version to 2.3

* Fix 20-app.ini in restore

* Replace app checkurl by webpath_available

* Adapt existing patches to 2.3

* Remove need to manage parameters.yml file; adapt to version 2.3

* Fix php5-redis dependency (redis-server is installed by YunoHost)

* Manage new domain_name parameter in change_url

* Upgrade to upstream version 2.3.1

* Upgrade to upstream version 2.3.2

* Remove obsolete calls to checkurl

* Fix check_process for upgrade from previous commit

* Fix Version number
2018-02-12 22:09:26 +01:00

61 lines
2.1 KiB
Diff

diff --git a/app/config/security.yml b/app/config/security.yml
index b07b509..62f2550 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -60,7 +60,7 @@ security:
logout:
path: /logout
- target: /
+ success_handler: yunohost.logout_success_handler
access_control:
- { path: ^/api/doc, roles: IS_AUTHENTICATED_ANONYMOUSLY }
diff --git a/app/config/services.yml b/app/config/services.yml
index 8a09fde..ee63e06 100644
--- a/app/config/services.yml
+++ b/app/config/services.yml
@@ -43,6 +43,10 @@
tags:
- { name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin }
+ yunohost.logout_success_handler:
+ class: Wallabag\YunoHostBundle\Security\LogoutSuccessHandler
+
+
yunohost.ldap:
class: Symfony\Component\Ldap\LdapClient
arguments: ["localhost"]
diff --git a/src/Wallabag/YunoHostBundle/Security/LogoutSuccessHandler.php b/src/Wallabag/YunoHostBundle/Security/LogoutSuccessHandler.php
new file mode 100644
index 0000000..b326824
--- /dev/null
+++ b/src/Wallabag/YunoHostBundle/Security/LogoutSuccessHandler.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Wallabag\YunoHostBundle\Security;
+
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\RedirectResponse;
+use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;
+
+/**
+ * Redirects to the SSO logout URL in case of a successful logout.
+ *
+ * @see http://api.symfony.com/3.1/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.html
+ */
+class LogoutSuccessHandler implements LogoutSuccessHandlerInterface
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function onLogoutSuccess(Request $request)
+ {
+ // Retrieve the current SSO logout URL
+ $main_domain = exec('cat /etc/yunohost/current_host');
+ $url = 'https://' . $main_domain . '/yunohost/sso/?action=logout';
+
+ return new RedirectResponse($url);
+ }
+}