From 696fb9b22c9849bd8f3e03adc52e681558694700 Mon Sep 17 00:00:00 2001 From: felegy Date: Thu, 28 Aug 2025 13:40:08 +0000 Subject: [PATCH] + ADD keycloack.hvg.hu auth via SAML --- .gitignore | 1 + composer.json | 3 ++- composer.lock | 20 +++++++++++++++++++- config/app/base.php | 1 + web/app/mu-plugins/app-mu.php | 11 +++++++++++ 5 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index dc8d683..da3615d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ web/.htaccess .env .env.* *.env +.env.* !.env.example !.envrc diff --git a/composer.json b/composer.json index 04e6eef..a3384b4 100644 --- a/composer.json +++ b/composer.json @@ -69,7 +69,8 @@ "wpackagist-plugin/wp-api-swaggerui": "^1.2", "wpackagist-plugin/cloudflare": "^4.12", "wpackagist-plugin/menu-image": "^3.13", - "wpackagist-plugin/code-snippets": "^3.6" + "wpackagist-plugin/code-snippets": "^3.6", + "wpackagist-plugin/saml-sso-wp-single-sign-on": "^1.4" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 3f6f8cc..5e8af8c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1ff66c5f617ebae9a7e51e2035af2260", + "content-hash": "4d40ac4d8a55624c5dec818326c4321d", "packages": [ { "name": "aws/aws-crt-php", @@ -2090,6 +2090,24 @@ "type": "wordpress-plugin", "homepage": "https://wordpress.org/plugins/menu-image/" }, + { + "name": "wpackagist-plugin/saml-sso-wp-single-sign-on", + "version": "1.4.8", + "source": { + "type": "svn", + "url": "https://plugins.svn.wordpress.org/saml-sso-wp-single-sign-on/", + "reference": "tags/1.4.8" + }, + "dist": { + "type": "zip", + "url": "https://downloads.wordpress.org/plugin/saml-sso-wp-single-sign-on.1.4.8.zip" + }, + "require": { + "composer/installers": "^1.0 || ^2.0" + }, + "type": "wordpress-plugin", + "homepage": "https://wordpress.org/plugins/saml-sso-wp-single-sign-on/" + }, { "name": "wpackagist-plugin/two-factor", "version": "0.14.0", diff --git a/config/app/base.php b/config/app/base.php index 89cb54f..9d98bf8 100644 --- a/config/app/base.php +++ b/config/app/base.php @@ -29,6 +29,7 @@ array_push($env_keys, 'CLOUDFLARE_EMAIL'); array_push($env_keys, 'WP_CF_ACCESS_AUTH_DOMAIN'); array_push($env_keys, 'WP_CF_ACCESS_JWT_AUD'); array_push($env_keys, 'WP_CF_ACCESS_REDIRECT_LOGIN'); +array_push($env_keys, 'LOGOUT_REDIRECT_URL'); ### # App Secret environment keys diff --git a/web/app/mu-plugins/app-mu.php b/web/app/mu-plugins/app-mu.php index 87629a6..581d690 100644 --- a/web/app/mu-plugins/app-mu.php +++ b/web/app/mu-plugins/app-mu.php @@ -49,6 +49,7 @@ class AppMuPlugin $this->remove_wp_version(); $this->cc_mime_types(); $this->two_factor_default(); + $this->on_logout_redirect(); } @@ -196,6 +197,16 @@ class AppMuPlugin return $providers; }); } + + private function on_logout_redirect() { + add_action('wp_logout', function () + { + if (defined('LOGOUT_REDIRECT_URL')) { + wp_redirect( LOGOUT_REDIRECT_URL ); + exit; + } + }); + } } new AppMuPlugin();