mirror of
https://github.com/YunoHost-Apps/wallabag2_ynh.git
synced 2024-10-01 13:35:06 +02:00
73 lines
2.5 KiB
Diff
73 lines
2.5 KiB
Diff
From 711f4a49fa7d4c471cd905870fecaa6f83156d46 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= <felix@piedallu.me>
|
|
Date: Tue, 11 Jun 2024 11:52:33 +0200
|
|
Subject: [PATCH 2/3] Configure a custom logout success handler for yunohost
|
|
ldap
|
|
|
|
---
|
|
app/config/security.yml | 2 +-
|
|
app/config/services.yml | 3 +++
|
|
.../Security/LogoutSuccessHandler.php | 27 +++++++++++++++++++
|
|
3 files changed, 31 insertions(+), 1 deletion(-)
|
|
create mode 100644 src/Wallabag/YunoHostBundle/Security/LogoutSuccessHandler.php
|
|
|
|
diff --git a/app/config/security.yml b/app/config/security.yml
|
|
index f4ea3d47..de6b705b 100644
|
|
--- a/app/config/security.yml
|
|
+++ b/app/config/security.yml
|
|
@@ -64,7 +64,7 @@ security:
|
|
|
|
logout:
|
|
path: /logout
|
|
- target: /
|
|
+ success_handler: yunohost.logout_success_handler
|
|
|
|
two_factor:
|
|
provider: fos_userbundle
|
|
diff --git a/app/config/services.yml b/app/config/services.yml
|
|
index c67341e8..7057ca42 100644
|
|
--- a/app/config/services.yml
|
|
+++ b/app/config/services.yml
|
|
@@ -401,3 +401,6 @@ services:
|
|
Symfony\Component\Ldap\Adapter\ExtLdap\Adapter:
|
|
arguments:
|
|
- host: localhost
|
|
+
|
|
+ yunohost.logout_success_handler:
|
|
+ class: Wallabag\YunoHostBundle\Security\LogoutSuccessHandler
|
|
diff --git a/src/Wallabag/YunoHostBundle/Security/LogoutSuccessHandler.php b/src/Wallabag/YunoHostBundle/Security/LogoutSuccessHandler.php
|
|
new file mode 100644
|
|
index 00000000..b3268243
|
|
--- /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);
|
|
+ }
|
|
+}
|
|
--
|
|
2.45.1
|
|
|