From b81cf801eb5470c6ea5700638f4f372fe9ea9543 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dominik=20Franti=C5=A1ek=20Bu=C4=8D=C3=ADk?=
 <bucik@ics.muni.cz>
Date: Fri, 25 Nov 2022 20:26:38 +0100
Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20Refactored=20disco,=20us?=
 =?UTF-8?q?e=20own=20config=20file?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

BREAKING CHANGE: needs its own config file module_elixir.php
---
 composer.lock                                 | 136 ++++++-------
 config-templates/module_elixir.php            |  44 ++---
 dictionaries/disco.definition.json            |   8 +
 lib/ConsentHelper.php                         |  43 ++--
 lib/Disco.php                                 | 185 ++++--------------
 lib/DiscoTemplate.php                         |   1 -
 lib/discowarning/WarningConfiguration.php     |  79 ++++++++
 lib/stats/Templates.php                       |  13 +-
 lib/stats/Utils.php                           |   4 +-
 themes/elixir/consent/consentform.php         |  17 +-
 .../elixir/default/includes/footer-full.php   |  13 +-
 themes/elixir/default/includes/footer.php     |  13 +-
 .../elixir/default/includes/header-full.php   |  29 +--
 themes/elixir/default/includes/header.php     |  23 ++-
 themes/elixir/elixir/disco-tpl.php            |  50 +++--
 themes/elixir/proxystatistics/detail-tpl.php  |  20 +-
 .../proxystatistics/loginsDashboard-tpl.php   |   4 +-
 .../elixir/proxystatistics/providers-tpl.php  |   4 +-
 themes/elixir/proxystatistics/summary-tpl.php |   4 +-
 .../elixir/proxystatistics/timeRange-tpl.php  |   4 +-
 20 files changed, 365 insertions(+), 329 deletions(-)
 create mode 100644 dictionaries/disco.definition.json
 create mode 100644 lib/discowarning/WarningConfiguration.php

diff --git a/composer.lock b/composer.lock
index 7cff5fd..debab5c 100644
--- a/composer.lock
+++ b/composer.lock
@@ -434,16 +434,16 @@
         },
         {
             "name": "mobiledetect/mobiledetectlib",
-            "version": "2.8.39",
+            "version": "2.8.41",
             "source": {
                 "type": "git",
                 "url": "https://github.com/serbanghita/Mobile-Detect.git",
-                "reference": "0fd6753003fc870f6e229bae869cc1337c99bc45"
+                "reference": "fc9cccd4d3706d5a7537b562b59cc18f9e4c0cb1"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/0fd6753003fc870f6e229bae869cc1337c99bc45",
-                "reference": "0fd6753003fc870f6e229bae869cc1337c99bc45",
+                "url": "https://api.github.com/repos/serbanghita/Mobile-Detect/zipball/fc9cccd4d3706d5a7537b562b59cc18f9e4c0cb1",
+                "reference": "fc9cccd4d3706d5a7537b562b59cc18f9e4c0cb1",
                 "shasum": ""
             },
             "require": {
@@ -484,9 +484,9 @@
             ],
             "support": {
                 "issues": "https://github.com/serbanghita/Mobile-Detect/issues",
-                "source": "https://github.com/serbanghita/Mobile-Detect/tree/2.8.39"
+                "source": "https://github.com/serbanghita/Mobile-Detect/tree/2.8.41"
             },
-            "time": "2022-02-17T19:24:25+00:00"
+            "time": "2022-11-08T18:31:26+00:00"
         },
         {
             "name": "paragonie/constant_time_encoding",
@@ -1367,16 +1367,16 @@
         },
         {
             "name": "simplesamlphp/saml2",
-            "version": "v4.6.3",
+            "version": "v4.6.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/simplesamlphp/saml2.git",
-                "reference": "bfc9c79dd6b728a41d1de988f545f6e64728a51d"
+                "reference": "35e4cac48ef97d454d25a92eb24c85cadf96de9d"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/simplesamlphp/saml2/zipball/bfc9c79dd6b728a41d1de988f545f6e64728a51d",
-                "reference": "bfc9c79dd6b728a41d1de988f545f6e64728a51d",
+                "url": "https://api.github.com/repos/simplesamlphp/saml2/zipball/35e4cac48ef97d454d25a92eb24c85cadf96de9d",
+                "reference": "35e4cac48ef97d454d25a92eb24c85cadf96de9d",
                 "shasum": ""
             },
             "require": {
@@ -1419,9 +1419,9 @@
             "description": "SAML2 PHP library from SimpleSAMLphp",
             "support": {
                 "issues": "https://github.com/simplesamlphp/saml2/issues",
-                "source": "https://github.com/simplesamlphp/saml2/tree/v4.6.3"
+                "source": "https://github.com/simplesamlphp/saml2/tree/v4.6.5"
             },
-            "time": "2022-06-13T14:04:10+00:00"
+            "time": "2022-11-23T12:50:43+00:00"
         },
         {
             "name": "simplesamlphp/simplesamlphp",
@@ -4340,16 +4340,16 @@
         },
         {
             "name": "symfony/polyfill-ctype",
-            "version": "v1.26.0",
+            "version": "v1.27.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-ctype.git",
-                "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4"
+                "reference": "5bbc823adecdae860bb64756d639ecfec17b050a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
-                "reference": "6fd1b9a79f6e3cf65f9e679b23af304cd9e010d4",
+                "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a",
+                "reference": "5bbc823adecdae860bb64756d639ecfec17b050a",
                 "shasum": ""
             },
             "require": {
@@ -4364,7 +4364,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "1.26-dev"
+                    "dev-main": "1.27-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -4402,7 +4402,7 @@
                 "portable"
             ],
             "support": {
-                "source": "https://github.com/symfony/polyfill-ctype/tree/v1.26.0"
+                "source": "https://github.com/symfony/polyfill-ctype/tree/v1.27.0"
             },
             "funding": [
                 {
@@ -4418,20 +4418,20 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-05-24T11:49:31+00:00"
+            "time": "2022-11-03T14:55:06+00:00"
         },
         {
             "name": "symfony/polyfill-intl-grapheme",
-            "version": "v1.26.0",
+            "version": "v1.27.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-intl-grapheme.git",
-                "reference": "433d05519ce6990bf3530fba6957499d327395c2"
+                "reference": "511a08c03c1960e08a883f4cffcacd219b758354"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2",
-                "reference": "433d05519ce6990bf3530fba6957499d327395c2",
+                "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/511a08c03c1960e08a883f4cffcacd219b758354",
+                "reference": "511a08c03c1960e08a883f4cffcacd219b758354",
                 "shasum": ""
             },
             "require": {
@@ -4443,7 +4443,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "1.26-dev"
+                    "dev-main": "1.27-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -4483,7 +4483,7 @@
                 "shim"
             ],
             "support": {
-                "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0"
+                "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.27.0"
             },
             "funding": [
                 {
@@ -4499,20 +4499,20 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-05-24T11:49:31+00:00"
+            "time": "2022-11-03T14:55:06+00:00"
         },
         {
             "name": "symfony/polyfill-intl-normalizer",
-            "version": "v1.26.0",
+            "version": "v1.27.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
-                "reference": "219aa369ceff116e673852dce47c3a41794c14bd"
+                "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd",
-                "reference": "219aa369ceff116e673852dce47c3a41794c14bd",
+                "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/19bd1e4fcd5b91116f14d8533c57831ed00571b6",
+                "reference": "19bd1e4fcd5b91116f14d8533c57831ed00571b6",
                 "shasum": ""
             },
             "require": {
@@ -4524,7 +4524,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "1.26-dev"
+                    "dev-main": "1.27-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -4567,7 +4567,7 @@
                 "shim"
             ],
             "support": {
-                "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0"
+                "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.27.0"
             },
             "funding": [
                 {
@@ -4583,20 +4583,20 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-05-24T11:49:31+00:00"
+            "time": "2022-11-03T14:55:06+00:00"
         },
         {
             "name": "symfony/polyfill-mbstring",
-            "version": "v1.26.0",
+            "version": "v1.27.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-mbstring.git",
-                "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e"
+                "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
-                "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e",
+                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
+                "reference": "8ad114f6b39e2c98a8b0e3bd907732c207c2b534",
                 "shasum": ""
             },
             "require": {
@@ -4611,7 +4611,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "1.26-dev"
+                    "dev-main": "1.27-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -4650,7 +4650,7 @@
                 "shim"
             ],
             "support": {
-                "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0"
+                "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.27.0"
             },
             "funding": [
                 {
@@ -4666,20 +4666,20 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-05-24T11:49:31+00:00"
+            "time": "2022-11-03T14:55:06+00:00"
         },
         {
             "name": "symfony/polyfill-php72",
-            "version": "v1.26.0",
+            "version": "v1.27.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php72.git",
-                "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2"
+                "reference": "869329b1e9894268a8a61dabb69153029b7a8c97"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/bf44a9fd41feaac72b074de600314a93e2ae78e2",
-                "reference": "bf44a9fd41feaac72b074de600314a93e2ae78e2",
+                "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/869329b1e9894268a8a61dabb69153029b7a8c97",
+                "reference": "869329b1e9894268a8a61dabb69153029b7a8c97",
                 "shasum": ""
             },
             "require": {
@@ -4688,7 +4688,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "1.26-dev"
+                    "dev-main": "1.27-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -4726,7 +4726,7 @@
                 "shim"
             ],
             "support": {
-                "source": "https://github.com/symfony/polyfill-php72/tree/v1.26.0"
+                "source": "https://github.com/symfony/polyfill-php72/tree/v1.27.0"
             },
             "funding": [
                 {
@@ -4742,20 +4742,20 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-05-24T11:49:31+00:00"
+            "time": "2022-11-03T14:55:06+00:00"
         },
         {
             "name": "symfony/polyfill-php73",
-            "version": "v1.26.0",
+            "version": "v1.27.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php73.git",
-                "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85"
+                "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/e440d35fa0286f77fb45b79a03fedbeda9307e85",
-                "reference": "e440d35fa0286f77fb45b79a03fedbeda9307e85",
+                "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/9e8ecb5f92152187c4799efd3c96b78ccab18ff9",
+                "reference": "9e8ecb5f92152187c4799efd3c96b78ccab18ff9",
                 "shasum": ""
             },
             "require": {
@@ -4764,7 +4764,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "1.26-dev"
+                    "dev-main": "1.27-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -4805,7 +4805,7 @@
                 "shim"
             ],
             "support": {
-                "source": "https://github.com/symfony/polyfill-php73/tree/v1.26.0"
+                "source": "https://github.com/symfony/polyfill-php73/tree/v1.27.0"
             },
             "funding": [
                 {
@@ -4821,20 +4821,20 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-05-24T11:49:31+00:00"
+            "time": "2022-11-03T14:55:06+00:00"
         },
         {
             "name": "symfony/polyfill-php80",
-            "version": "v1.26.0",
+            "version": "v1.27.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php80.git",
-                "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace"
+                "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace",
-                "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace",
+                "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
+                "reference": "7a6ff3f1959bb01aefccb463a0f2cd3d3d2fd936",
                 "shasum": ""
             },
             "require": {
@@ -4843,7 +4843,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "1.26-dev"
+                    "dev-main": "1.27-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -4888,7 +4888,7 @@
                 "shim"
             ],
             "support": {
-                "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0"
+                "source": "https://github.com/symfony/polyfill-php80/tree/v1.27.0"
             },
             "funding": [
                 {
@@ -4904,20 +4904,20 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-05-10T07:21:04+00:00"
+            "time": "2022-11-03T14:55:06+00:00"
         },
         {
             "name": "symfony/polyfill-php81",
-            "version": "v1.26.0",
+            "version": "v1.27.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php81.git",
-                "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1"
+                "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1",
-                "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1",
+                "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/707403074c8ea6e2edaf8794b0157a0bfa52157a",
+                "reference": "707403074c8ea6e2edaf8794b0157a0bfa52157a",
                 "shasum": ""
             },
             "require": {
@@ -4926,7 +4926,7 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-main": "1.26-dev"
+                    "dev-main": "1.27-dev"
                 },
                 "thanks": {
                     "name": "symfony/polyfill",
@@ -4967,7 +4967,7 @@
                 "shim"
             ],
             "support": {
-                "source": "https://github.com/symfony/polyfill-php81/tree/v1.26.0"
+                "source": "https://github.com/symfony/polyfill-php81/tree/v1.27.0"
             },
             "funding": [
                 {
@@ -4983,7 +4983,7 @@
                     "type": "tidelift"
                 }
             ],
-            "time": "2022-05-24T11:49:31+00:00"
+            "time": "2022-11-03T14:55:06+00:00"
         },
         {
             "name": "symfony/routing",
diff --git a/config-templates/module_elixir.php b/config-templates/module_elixir.php
index 6d8063a..1f247b9 100644
--- a/config-templates/module_elixir.php
+++ b/config-templates/module_elixir.php
@@ -2,27 +2,27 @@
 
 declare(strict_types=1);
 
-/**
- * The config template for module ELIXIR.
- */
-$config = [
-    /*
-     * The clientId from CSC_MFA server
-     */
-    'clientId' => '',
-
-    /*
-     * The clientSecret from CSC_MFA server
-     */
-    'clientSecret' => '',
+use SimpleSAML\Module\elixir\Disco;
+use SimpleSAML\Module\elixir\discowarning\WarningConfiguration;
 
-    /*
-     * List of requested scopes
-     */
-    'requestedScopes' => [],
-
-    /*
-     * The openid configuration url of CSC_MFA server
-     */
-    'openidConfigurationUrl' => '',
+$config = [
+    Disco::DISCO => [
+        // required upstream IdP, that will be used as chosen IdP
+        Disco::UPSTREAM_IDP_ENTITY_ID => 'https://proxy.aai.lifescience-ri.eu/proxy',
+        // warning configuration
+        WarningConfiguration::WARNING_CONFIG => [
+            // enabled or not
+            WarningConfiguration::ENABLED => true,
+            // type of the warning - type ERROR prevents users from continuing to log in
+            WarningConfiguration::TYPE => WarningConfiguration::WARNING_TYPE_WARNING,
+            // displayed title - provide English version of the text
+            WarningConfiguration::TITLE => [
+                'en' => 'Sample warning title',
+            ],
+            // displayed text - provide English version of the text
+            WarningConfiguration::TEXT => [
+                'en' => 'Sample warning text',
+            ],
+        ],
+    ],
 ];
diff --git a/dictionaries/disco.definition.json b/dictionaries/disco.definition.json
new file mode 100644
index 0000000..76d89b8
--- /dev/null
+++ b/dictionaries/disco.definition.json
@@ -0,0 +1,8 @@
+{
+  "warning_header": {
+    "en": "Warning!"
+  },
+  "warning_continue": {
+    "en": "Continue"
+  }
+}
diff --git a/lib/ConsentHelper.php b/lib/ConsentHelper.php
index 7eb92d4..546d272 100644
--- a/lib/ConsentHelper.php
+++ b/lib/ConsentHelper.php
@@ -4,12 +4,7 @@ namespace SimpleSAML\Module\elixir;
 
 class ConsentHelper
 {
-
-    public function __construct()
-    {
-    }
-
-    const EU_EAA = [
+    private const EU_EAA = [
         'AT' => 'Austria',
         'BE' => 'Belgium',
         'BG' => 'Bulgaria',
@@ -42,6 +37,10 @@ class ConsentHelper
         'GB' => 'United Kingdom',
     ];
 
+    public function __construct()
+    {
+    }
+
     public static function getJurisdiction($dstMetadata): string
     {
         $countryCodes = json_decode(file_get_contents('http://country.io/names.json'), true);
@@ -121,16 +120,26 @@ class ConsentHelper
                 echo '    <h6>This service is ' . $parsedJurisdiction . '</h6>' . PHP_EOL;
             }
             if ($parsedJurisdiction === 'EMBL') {
-                echo '    <p>In order to access the requested services, the Life Science Login needs to transfer your personal data to an international organization outside EU/EEA jurisdictions.<br/><i>Please be aware that upon transfer your personal data will be protected by <a href="https://www.embl.org/documents/document/internal-policy-no-68-on-general-data-protection/" target="_blank">EMBL’s Internal Policy 68 on General Data Protection</a>.</i>' . PHP_EOL;
+                echo '    <p>In order to access the requested services, the Life Science Login needs to transfer ' .
+                    'your personal data to an international organization outside EU/EEA jurisdictions.<br/>' .
+                    '<i>Please be aware that upon transfer your personal data will be protected by <a href="' .
+                    'https://www.embl.org/documents/document/internal-policy-no-68-on-general-data-protection/"' .
+                    ' target="_blank">EMBL’s Internal Policy 68 on General Data Protection</a>.</i>' . PHP_EOL;
             } else {
-                echo '    <p>In order to access the requested services, the Life Science Login needs to transfer your personal data to a country outside EU/EEA. We cannot guarantee that this country offers an adequately high level of personal data protection as EU/EEA countries.</p>' . PHP_EOL;
+                echo '    <p>In order to access the requested services, the Life Science Login needs to transfer ' .
+                    'your personal data to a country outside EU/EEA. We cannot guarantee that this country offers ' .
+                    'an adequately high level of personal data protection as EU/EEA countries.</p>' . PHP_EOL;
             }
             if (false !== $spPrivacyPolicy) {
-                echo '<h6>Please, read the <a target="_blank" href="' .$spPrivacyPolicy . '">Privacy Policy</a> of the service provider to learn more about its commitments to protect your data.' . PHP_EOL;
+                echo '<h6>Please, read the <a target="_blank" href="' . $spPrivacyPolicy .
+                    '">Privacy Policy</a> of the service provider to learn more about its ' .
+                    'commitments to protect your data.' . PHP_EOL;
             }
             echo '    <div class="form-check">' . PHP_EOL;
-            echo '        <input class="form-check-input" type="checkbox" name="transfer" id="transfer" data-np-checked="1">' . PHP_EOL;
-            echo '        <label class="form-check-label" for="transfer">To continue, consent to the transfer of your personal data.</label>' . PHP_EOL;
+            echo '        <input class="form-check-input" type="checkbox" name="transfer" id="transfer"' .
+                ' data-np-checked="1">' . PHP_EOL;
+            echo '        <label class="form-check-label" for="transfer">To continue, consent to the transfer of ' .
+                'your personal data.</label>' . PHP_EOL;
             echo '    </div>' . PHP_EOL;
             echo '</div>' . PHP_EOL;
         }
@@ -149,8 +158,12 @@ class ConsentHelper
     {
         if ((!empty($dstMetadata['test.sp']) && $dstMetadata['test.sp']) || empty($dstMetadata['accepted_tos'])) {
             echo '<div class="alert alert-warning" role="alert">' . PHP_EOL;
-            echo '    <p>You are entering a service that is in the test environment of Life Science Login. The test environment is for service developers to test their relying service’s AAI integration before requesting to move them to the Life Science Login production environment.</p>' . PHP_EOL;
-            echo '    <p>The test environment is not intended for common users. You are able to access the service because you have opted in as a test user. You need to refresh your registration every 30 days.</p>' . PHP_EOL;
+            echo '    <p>You are entering a service that is in the test environment of Life Science Login. ' .
+                'The test environment is for service developers to test their relying service’s AAI integration ' .
+                'before requesting to move them to the Life Science Login production environment.</p>' . PHP_EOL;
+            echo '    <p>The test environment is not intended for common users. You are able to access the service ' .
+                'because you have opted in as a test user. You need to refresh your registration every 30 days.</p>' .
+                PHP_EOL;
             echo '</div>' . PHP_EOL;
         }
     }
@@ -172,7 +185,5 @@ class ConsentHelper
         }
 
         return htmlspecialchars($dstName);
-
     }
-
-}
\ No newline at end of file
+}
diff --git a/lib/Disco.php b/lib/Disco.php
index d46c566..6aeab44 100644
--- a/lib/Disco.php
+++ b/lib/Disco.php
@@ -4,14 +4,10 @@ declare(strict_types=1);
 
 namespace SimpleSAML\Module\elixir;
 
-use SimpleSAML\Auth\State;
 use SimpleSAML\Configuration;
 use SimpleSAML\Logger;
-use SimpleSAML\Module\authswitcher\DiscoUtils;
 use SimpleSAML\Module\discopower\PowerIdPDisco;
-use SimpleSAML\Module\perun\Auth\Process\MultifactorAcrs;
-use SimpleSAML\Module\perun\model\WarningConfiguration;
-use SimpleSAML\Utils\HTTP;
+use SimpleSAML\Module\elixir\discowarning\WarningConfiguration;
 
 /**
  * This class implements a IdP discovery service.
@@ -24,156 +20,79 @@ use SimpleSAML\Utils\HTTP;
  */
 class Disco extends PowerIdPDisco
 {
-    public const CONFIG_FILE_NAME = 'module_perun.php';
+    private const DEBUG_PREFIX = "elixir:Disco - :";
 
-    public const URN_CESNET_PROXYIDP_IDPENTITYID = 'urn:cesnet:proxyidp:idpentityid:';
+    public const CONFIG_FILE_NAME = 'module_elixir.php';
 
-    public const LS_IDP = 'https://proxy.aai.lifescience-ri.eu/proxy';
-
-    // ROOT CONFIGURATION ENTRY
-    public const WAYF = 'wayf_config';
-
-    public const INTERFACE = 'interface';
-
-    public const RPC = 'rpc';
-
-    public const REMOVE_AUTHN_CONTEXT_CLASS_PREFIXES = 'remove_authn_context_class_ref_prefixes';
-
-    public const ADD_AUTHN_CONTEXT_CLASSES_FOR_MFA = 'add_authn_context_classes_for_mfa';
-
-    public const RETURN = 'return';
-
-    public const AUTHN_CONTEXT_CLASS_REF = 'AuthnContextClassRef';
+    public const AUTH_ID = 'AuthID';
 
-    public const WARNING_ATTRIBUTES = 'warningAttributes';
+    public const SAML_SP_SSO = 'saml:sp:sso';
 
-    public const AUTH_ID = 'AuthID';
+    public const WARNING = 'warningAttributes';
 
     public const CONTINUE_URL = 'continueUrl';
 
-    // STATE KEYS
-    public const SAML_REQUESTED_AUTHN_CONTEXT = 'saml:RequestedAuthnContext';
-
-    public const STATE_AUTHN_CONTEXT_CLASS_REF = 'AuthnContextClassRef';
+    // ROOT CONFIGURATION ENTRY
 
-    public const SAML_SP_SSO = 'saml:sp:sso';
+    public const DISCO = 'disco';
 
-    public const NAME = 'name';
+    public const UPSTREAM_IDP_ENTITY_ID = 'upstream_idp_entity_id';
 
     // VARIABLES
 
-    private array $originalAuthnContextClassRef = [];
+    private $discoConfiguration;
 
-    private $wayfConfiguration;
+    private $upstreamIdpEntityId;
 
-    private Configuration $perunModuleConfiguration;
-
-    private $proxyIdpEntityId;
-
-    private $state;
+    private $warningConfiguration = null;
 
     public function __construct(array $metadataSets, $instance)
     {
-        //LOAD CONFIG FOR MODULE PERUN, WHICH CONTAINS WAYF CONFIGURATION
+        parent::__construct($metadataSets, $instance);
         try {
-            $this->perunModuleConfiguration = Configuration::getConfig(self::CONFIG_FILE_NAME);
-            $this->wayfConfiguration = $this->perunModuleConfiguration->getConfigItem(self::WAYF);
+            $elixirConfig = Configuration::getConfig(self::CONFIG_FILE_NAME);
+            if (empty($elixirConfig->getValue(self::DISCO, []))) {
+                Logger::error(self::DEBUG_PREFIX . "missing key '" . self::DISCO . "' in module config file");
+                throw new \Exception();
+            }
+            $this->discoConfiguration = $elixirConfig->getConfigItem(self::DISCO);
         } catch (\Exception $ex) {
-            Logger::error("perun:disco-tpl: missing or invalid '" . self::CONFIG_FILE_NAME . "' config file");
+            Logger::error(self::DEBUG_PREFIX . "missing or invalid '" . self::CONFIG_FILE_NAME . "' config file");
             throw $ex;
         }
 
-        if (!array_key_exists(self::RETURN, $_GET)) {
-            throw new \Exception('Missing parameter: ' . self::RETURN);
+        $this->upstreamIdpEntityId = $this->discoConfiguration->getString(self::UPSTREAM_IDP_ENTITY_ID, '');
+        if (empty($this->upstreamIdpEntityId)) {
+            Logger::error(
+                self::DEBUG_PREFIX
+                . "missing setting of upstream IdP that should be used. Use option '"
+                . self::UPSTREAM_IDP_ENTITY_ID
+                . "' in the discovery page configuration block to set the EntityID of the IdP"
+            );
         }
-        $returnURL = HTTP::checkURLAllowed($_GET[self::RETURN]);
-
-        parse_str(parse_url($returnURL)['query'], $query);
-
-        if (isset($query[self::AUTH_ID])) {
-            $id = explode(':', $query[self::AUTH_ID])[0];
-            $state = State::loadState($id, self::SAML_SP_SSO, true);
-            if (null !== $state) {
-                if (isset($state[self::SAML_REQUESTED_AUTHN_CONTEXT][self::AUTHN_CONTEXT_CLASS_REF])) {
-                    $this->originalAuthnContextClassRef = $state[self::SAML_REQUESTED_AUTHN_CONTEXT][self::AUTHN_CONTEXT_CLASS_REF];
-
-                    $this->removeAuthContextClassRefWithPrefixes($state);
-                    DiscoUtils::setUpstreamRequestedAuthnContext($state);
-                    if (isset($state['IdPMetadata']['entityid'])) {
-                        $this->proxyIdpEntityId = $state['IdPMetadata']['entityid'];
-                    }
-                    State::saveState($state, self::SAML_SP_SSO);
-                }
-
-                $e = explode('=', $returnURL)[0];
-                $newReturnURL = $e . '=' . urlencode($id);
-                $_GET[self::RETURN] = $newReturnURL;
-            }
-            $this->state = $state;
+        if ($this->discoConfiguration->hasValue(WarningConfiguration::WARNING_CONFIG)) {
+            $this->warningConfiguration = new WarningConfiguration();
         }
-
-        parent::__construct($metadataSets, $instance);
     }
 
-
-    /**
-     * Handles a request to this discovery service. It is entry point of Discovery service.
-     *
-     * The IdP disco parameters should be set before calling this function.
-     */
     public function handleRequest()
     {
         $this->start();
 
-        // IF IS SET AUTHN CONTEXT CLASS REF, REDIRECT USER TO THE IDP
-        if (!empty($this->originalAuthnContextClassRef)) {
-            // Check authnContextClassRef and select IdP directly if the correct value is set
-            foreach ($this->originalAuthnContextClassRef as $value) {
-                // VERIFY THE PREFIX IS CORRECT AND WE CAN PERFORM THE REDIRECT
-                $acrStartSubstr = substr($value, 0, strlen(self::URN_CESNET_PROXYIDP_IDPENTITYID));
-                if (self::URN_CESNET_PROXYIDP_IDPENTITYID === $acrStartSubstr) {
-                    $idpEntityId = substr($value, strlen(self::URN_CESNET_PROXYIDP_IDPENTITYID), strlen($value));
-                    if ($idpEntityId === $this->proxyIdpEntityId) {
-                        continue;
-                    }
-                    Logger::info('Redirecting to ' . $idpEntityId);
-                    $continueUrl = self::buildContinueUrl(
-                        $this->spEntityId,
-                        $this->returnURL,
-                        $this->returnIdParam,
-                        $idpEntityId
-                    );
-                    HTTP::redirectTrustedURL($continueUrl);
-                    exit;
-                }
-            }
-        }
-
         $continueUrl = self::buildContinueUrl(
-                $this->spEntityId,
-                $this->returnURL,
-                $this->returnIdParam,
-                !empty($this->state['aarc_hinted_idp']) ? $this->state['aarc_hinted_idp'] : self::LS_IDP
+            $this->spEntityId,
+            $this->returnURL,
+            $this->returnIdParam,
+            $this->upstreamIdpEntityId
         );
 
-        $warningInstance = WarningConfiguration::getInstance();
-        $warningAttributes = $warningInstance->getWarningAttributes();
-
         $t = new DiscoTemplate($this->config);
-        $t->data[self::WARNING_ATTRIBUTES] = $warningAttributes;
+        $t->data[self::WARNING] = $this->warningConfiguration;
         $t->data[self::CONTINUE_URL] = $continueUrl;
         $t->show();
     }
 
-   /**
-     * @param $entityID
-     * @param $return
-     * @param $returnIDParam
-     * @param $idpEntityId
-     *
-     * @return string url where user should be redirected when he choose idp
-     */
-    public static function buildContinueUrl(
+    private static function buildContinueUrl(
         string $entityID,
         string $return,
         string $returnIDParam,
@@ -185,36 +104,4 @@ class Disco extends PowerIdPDisco
             'returnIDParam=' . urlencode($returnIDParam) . '&' .
             'idpentityid=' . urlencode($idpEntityId);
     }
-
-    /**
-     * This method remove all AuthnContextClassRef which start with prefix from configuration.
-     *
-     * @param mixed $state
-     */
-    public function removeAuthContextClassRefWithPrefixes(&$state)
-    {
-        $prefixes = $this->wayfConfiguration->getArray(self::REMOVE_AUTHN_CONTEXT_CLASS_PREFIXES, []);
-
-        if (empty($prefixes)) {
-            return;
-        }
-        unset($state[self::SAML_REQUESTED_AUTHN_CONTEXT][self::STATE_AUTHN_CONTEXT_CLASS_REF]);
-        $filteredAcrs = [];
-        foreach ($this->originalAuthnContextClassRef as $acr) {
-            $acr = trim($acr);
-            $retain = true;
-            foreach ($prefixes as $prefix) {
-                if (substr($acr, 0, strlen($prefix)) === $prefix) {
-                    $retain = false;
-                    break;
-                }
-            }
-            if ($retain) {
-                $filteredAcrs[] = $acr;
-            }
-        }
-        if (!empty($filteredAcrs)) {
-            $state[self::SAML_REQUESTED_AUTHN_CONTEXT][self::STATE_AUTHN_CONTEXT_CLASS_REF] = $filteredAcrs;
-        }
-    }
 }
diff --git a/lib/DiscoTemplate.php b/lib/DiscoTemplate.php
index c4fc614..ff1580a 100644
--- a/lib/DiscoTemplate.php
+++ b/lib/DiscoTemplate.php
@@ -15,7 +15,6 @@ use SimpleSAML\XHTML\Template;
  */
 class DiscoTemplate extends Template
 {
-
     public const NAME = 'name';
 
     /**
diff --git a/lib/discowarning/WarningConfiguration.php b/lib/discowarning/WarningConfiguration.php
new file mode 100644
index 0000000..e71416f
--- /dev/null
+++ b/lib/discowarning/WarningConfiguration.php
@@ -0,0 +1,79 @@
+<?php
+
+declare(strict_types=1);
+
+namespace SimpleSAML\Module\elixir\discowarning;
+
+use SimpleSAML\Configuration;
+use SimpleSAML\Module\elixir\Disco;
+
+/**
+ * Class WarningConfiguration provides an option to load warning in disco-tpl from different types of sources.
+ */
+class WarningConfiguration
+{
+    public const CONFIG_FILE_NAME = 'module_elixir.php';
+
+    public const WARNING_CONFIG = 'warning_config';
+
+    public const TYPE = 'type';
+
+    public const ENABLED = 'enabled';
+
+    public const TITLE = 'title';
+
+    public const TEXT = 'text';
+
+    public const WARNING_TYPE_INFO = 'INFO';
+
+    public const WARNING_TYPE_WARNING = 'WARNING';
+
+    public const WARNING_TYPE_ERROR = 'ERROR';
+
+    public const ALLOWED_TYPES = [self::WARNING_TYPE_INFO, self::WARNING_TYPE_WARNING, self::WARNING_TYPE_ERROR];
+
+    private bool $enabled = false;
+
+    private string $type = '';
+
+    private array $title = [];
+
+    private array $text = [];
+
+    /**
+     * Function returns the instance of WarningConfiguration.
+     */
+    public function __construct()
+    {
+        $config = Configuration::getConfig(self::CONFIG_FILE_NAME)
+            ->getConfigItem(Disco::DISCO)
+            ->getConfigItem(self::WARNING_CONFIG, []);
+        if (empty($config)) {
+            return;
+        }
+        $this->enabled = $config->getBoolean(self::ENABLED, false);
+        $this->type = $config->getValueValidate(self::TYPE, self::ALLOWED_TYPES);
+        $this->title = $config->getArray(self::TITLE);
+        $this->text = $config->getArray(self::TEXT);
+    }
+
+    public function isEnabled(): bool
+    {
+        return $this->enabled;
+    }
+
+    public function getType(): string
+    {
+        return $this->type;
+    }
+
+    public function getTitle(): array
+    {
+        return $this->title;
+    }
+
+    public function getText(): array
+    {
+        return $this->text;
+    }
+}
diff --git a/lib/stats/Templates.php b/lib/stats/Templates.php
index 0fd4714..66dbf34 100644
--- a/lib/stats/Templates.php
+++ b/lib/stats/Templates.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 namespace SimpleSAML\Module\elixir\stats;
 
@@ -133,9 +135,12 @@ class Templates
         ); // indexed from 0
 
         $t->data['tabsAttributes'] = [
-            'PROXY' => 'id="tab-1" href="' . Module::getModuleURL('elixir/summary.php') . '?lastDays=' . $lastDays . '"',
-            'IDP' => 'id="tab-2" href="' . Module::getModuleURL('elixir/identityProviders.php') . '?lastDays=' . $lastDays . '"',
-            'SP' => 'id="tab-3" href="' . Module::getModuleURL('elixir/serviceProviders.php') . '?lastDays=' . $lastDays . '"',
+            'PROXY' => 'id="tab-1" href="' . Module::getModuleURL('elixir/summary.php') .
+                '?lastDays=' . $lastDays . '"',
+            'IDP' => 'id="tab-2" href="' . Module::getModuleURL('elixir/identityProviders.php') .
+                '?lastDays=' . $lastDays . '"',
+            'SP' => 'id="tab-3" href="' . Module::getModuleURL('elixir/serviceProviders.php') .
+                '?lastDays=' . $lastDays . '"',
         ];
         $mode = $config->getMode();
         if (Config::MODE_PROXY !== $mode) {
diff --git a/lib/stats/Utils.php b/lib/stats/Utils.php
index 6d8d3c8..1b15bba 100644
--- a/lib/stats/Utils.php
+++ b/lib/stats/Utils.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 namespace SimpleSAML\Module\elixir\stats;
 
diff --git a/themes/elixir/consent/consentform.php b/themes/elixir/consent/consentform.php
index e97c946..5c9edf4 100644
--- a/themes/elixir/consent/consentform.php
+++ b/themes/elixir/consent/consentform.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 use SimpleSAML\Module\elixir\ConsentHelper;
 
@@ -17,7 +19,8 @@ $this->includeAtTemplateBase('includes/header.php');
         The service <strong><?php echo $dstName; ?></strong> requires access to your personal data.
         <?php
         if (false !== $this->data['sppp']) {
-            echo 'Please, read the <a target="_blank" href="' . $this->data['sppp'] . '">Privacy Policy</a> of the service to learn more about its commitments to protect your data.';
+            echo 'Please, read the <a target="_blank" href="' . $this->data['sppp']
+                . '">Privacy Policy</a> of the service to learn more about its commitments to protect your data.';
         }
         ?>
     </p>
@@ -32,7 +35,8 @@ $this->includeAtTemplateBase('includes/header.php');
         <div class="section">
             <div class="card-header" id="headingOne">
                 <h5 class="mb-0">
-                    <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
+                    <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseOne"
+                            aria-expanded="true" aria-controls="collapseOne">
                         User Information
                     </button>
                 </h5>
@@ -44,7 +48,8 @@ $this->includeAtTemplateBase('includes/header.php');
             </div>
             <div class="card-header" id="headingThree">
                 <h5 class="mb-0">
-                    <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseThree" aria-expanded="true" aria-controls="collapseThree">
+                    <button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseThree"
+                            aria-expanded="true" aria-controls="collapseThree">
                         Technical Information
                     </button>
                 </h5>
@@ -66,7 +71,9 @@ $this->includeAtTemplateBase('includes/header.php');
 
     ?>
     <div class="outro">
-        <p>For withdrawing consent, contact <a href="mailto:support@aai.lifescience-ri.eu">support@aai.lifescience-ri.eu</a></p>
+        <p>For withdrawing consent, contact <a href="mailto:support@aai.lifescience-ri.eu">
+                support@aai.lifescience-ri.eu</a>
+        </p>
     </div>
     <div class="footer-buttons">
         <div class="remember">
diff --git a/themes/elixir/default/includes/footer-full.php b/themes/elixir/default/includes/footer-full.php
index b5a76f9..cc56228 100644
--- a/themes/elixir/default/includes/footer-full.php
+++ b/themes/elixir/default/includes/footer-full.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 use SimpleSAML\Module;
 
@@ -13,7 +15,8 @@ if (!empty($this->data['htmlinject']['htmlContentPost'])) {
 </div> <!-- ENDCOL -->
 </div> <!-- ENDROW -->
 <footer>
-    <div class="footer offset-1 col-10 offset-sm-1 col-sm-10 offset-md-2 col-md-8 offset-lg-3 col-lg-6 offset-xl-3 col-xl-6">
+    <div class="footer offset-1 col-10 offset-sm-1 col-sm-10 offset-md-2 col-md-8 offset-lg-3
+     col-lg-6 offset-xl-3 col-xl-6">
         <div class="footer-contact">
             <a class="contact-link" href="mailto:support@aai.lifescience-ri.eu">Contact us</a>
         </div>
@@ -26,9 +29,9 @@ if (!empty($this->data['htmlinject']['htmlContentPost'])) {
 <script type="text/javascript" src="<?php echo Module::getModuleURL('elixir/res/js/bootstrap.min.js'); ?>"></script>
 <script type="text/javascript" src="<?php echo Module::getModuleURL('elixir/res/js/cmservice.js'); ?>"></script>
 <?php
-    if (array_key_exists('scripts', $this->data)) {
-        echo $this->data['scripts'];
-    }
+if (array_key_exists('scripts', $this->data)) {
+    echo $this->data['scripts'];
+}
 ?>
 </body>
 </html>
diff --git a/themes/elixir/default/includes/footer.php b/themes/elixir/default/includes/footer.php
index d7191de..e9cfcca 100644
--- a/themes/elixir/default/includes/footer.php
+++ b/themes/elixir/default/includes/footer.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 use SimpleSAML\Module;
 
@@ -15,7 +17,8 @@ if (!empty($this->data['htmlinject']['htmlContentPost'])) {
 </div> <!-- ENDCOL -->
 </div> <!-- ENDROW -->
 <footer>
-    <div class="footer offset-1 col-10 offset-sm-1 col-sm-10 offset-md-2 col-md-8 offset-lg-3 col-lg-6 offset-xl-3 col-xl-6">
+    <div class="footer offset-1 col-10 offset-sm-1 col-sm-10 offset-md-2 col-md-8
+     offset-lg-3 col-lg-6 offset-xl-3 col-xl-6">
         <div class="footer-contact">
             <a class="contact-link" href="mailto:support@aai.lifescience-ri.eu">Contact us</a>
         </div>
@@ -28,9 +31,9 @@ if (!empty($this->data['htmlinject']['htmlContentPost'])) {
 <script type="text/javascript" src="<?php echo Module::getModuleURL('elixir/res/js/bootstrap.min.js'); ?>"></script>
 <script type="text/javascript" src="<?php echo Module::getModuleURL('elixir/res/js/cmservice.js'); ?>"></script>
 <?php
-    if (array_key_exists('scripts', $this->data)) {
-        echo $this->data['scripts'];
-    }
+if (array_key_exists('scripts', $this->data)) {
+    echo $this->data['scripts'];
+}
 ?>
 </body>
 </html>
diff --git a/themes/elixir/default/includes/header-full.php b/themes/elixir/default/includes/header-full.php
index d71a5fb..9466deb 100644
--- a/themes/elixir/default/includes/header-full.php
+++ b/themes/elixir/default/includes/header-full.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 use SimpleSAML\Module;
 
@@ -43,9 +45,12 @@ header('X-Frame-Options: SAMEORIGIN');
 <html lang="en">
 <head>
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <link href="<?php echo Module::getModuleUrl('elixir/res/css/bootstrap.min.css'); ?>" rel="stylesheet" type="text/css"/>
-    <link href="<?php echo Module::getModuleUrl('elixir/res/css/eduteams.css'); ?>" rel="stylesheet" type="text/css"/>
-    <link href="<?php echo Module::getModuleUrl('elixir/res/css/cmservice.css'); ?>" rel="stylesheet" type="text/css"/>
+    <link href="<?php echo Module::getModuleUrl('elixir/res/css/bootstrap.min.css'); ?>"
+          rel="stylesheet" type="text/css"/>
+    <link href="<?php echo Module::getModuleUrl('elixir/res/css/eduteams.css'); ?>"
+          rel="stylesheet" type="text/css"/>
+    <link href="<?php echo Module::getModuleUrl('elixir/res/css/cmservice.css'); ?>"
+          rel="stylesheet" type="text/css"/>
     <script type="text/javascript" src="/<?php echo $this->data['baseurlpath']; ?>resources/script.js"></script>
     <title><?php echo (array_key_exists('header', $this->data)) ? $this->data['header'] : 'SimpleSAMLphp'; ?></title>
     <?php
@@ -57,7 +62,8 @@ header('X-Frame-Options: SAMEORIGIN');
     ?>
     <link rel="preconnect" href="https://fonts.googleapis.com">
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
-    <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
+    <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;
+    0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
     <?php
     if (array_key_exists('head', $this->data)) {
         echo '<!-- head -->' . $this->data['head'] . '<!-- /head -->';
@@ -68,14 +74,15 @@ header('X-Frame-Options: SAMEORIGIN');
 <div class="row">
     <div class="offset-1 col-10 offset-sm-1 col-sm-10 offset-md-2 col-md-8 offset-lg-3 col-lg-6 offset-xl-3 col-xl-6">
         <div class="text-center">
-            <img class="card-img-top" src="<?php echo Module::getModuleURL('elixir/res/img/lsaai_logo.png'); ?>" alt="Life Science Login logo">
+            <img class="card-img-top" src="<?php echo Module::getModuleURL('elixir/res/img/lsaai_logo.png'); ?>"
+                 alt="Life Science Login logo">
             <div class="card-body">
             <?php
-                if (isset($this->data['header'])) {
-                    echo '<h1>' . PHP_EOL;
-                    echo $this->data['header'];
-                    echo '</h1>' . PHP_EOL;
-                }
+            if (isset($this->data['header'])) {
+                echo '<h1>' . PHP_EOL;
+                echo $this->data['header'];
+                echo '</h1>' . PHP_EOL;
+            }
             ?>
             </div>
         </div>
diff --git a/themes/elixir/default/includes/header.php b/themes/elixir/default/includes/header.php
index 5429f41..59d0d01 100644
--- a/themes/elixir/default/includes/header.php
+++ b/themes/elixir/default/includes/header.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 use SimpleSAML\Module;
 
@@ -43,11 +45,16 @@ header('X-Frame-Options: SAMEORIGIN');
 <html lang="en">
 <head>
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
-    <link href="<?php echo Module::getModuleUrl('elixir/res/css/bootstrap.min.css'); ?>" rel="stylesheet" type="text/css"/>
-    <link href="<?php echo Module::getModuleUrl('elixir/res/css/eduteams.css'); ?>" rel="stylesheet" type="text/css"/>
-    <link href="<?php echo Module::getModuleUrl('elixir/res/css/cmservice.css'); ?>" rel="stylesheet" type="text/css"/>
+    <link href="<?php echo Module::getModuleUrl('elixir/res/css/bootstrap.min.css'); ?>"
+          rel="stylesheet" type="text/css"/>
+    <link href="<?php echo Module::getModuleUrl('elixir/res/css/eduteams.css'); ?>"
+          rel="stylesheet" type="text/css"/>
+    <link href="<?php echo Module::getModuleUrl('elixir/res/css/cmservice.css'); ?>"
+          rel="stylesheet" type="text/css"/>
     <script type="text/javascript" src="/<?php echo $this->data['baseurlpath']; ?>resources/script.js"></script>
-    <title><?php echo (array_key_exists('header', $this->data)) ? $this->data['header'] : 'SimpleSAMLphp'; ?></title>
+    <title>
+        <?php echo (array_key_exists('header', $this->data)) ? $this->data['header'] : 'SimpleSAMLphp'; ?>
+    </title>
     <?php
     if (!empty($this->data['htmlinject']['htmlContentHead'])) {
         foreach ($this->data['htmlinject']['htmlContentHead'] as $c) {
@@ -57,7 +64,8 @@ header('X-Frame-Options: SAMEORIGIN');
     ?>
     <link rel="preconnect" href="https://fonts.googleapis.com">
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
-    <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
+    <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;
+    0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
     <?php
     if (array_key_exists('head', $this->data)) {
         echo '<!-- head -->' . $this->data['head'] . '<!-- /head -->';
@@ -68,7 +76,8 @@ header('X-Frame-Options: SAMEORIGIN');
 <div class="row">
     <div class="offset-1 col-10 offset-sm-1 col-sm-10 offset-md-2 col-md-8 offset-lg-3 col-lg-6 offset-xl-3 col-xl-6">
         <div class="card">
-            <img class="card-img-top" src="<?php echo Module::getModuleURL('elixir/res/img/lsaai_logo.png'); ?>" alt="Life Science Login logo">
+            <img class="card-img-top" src="<?php echo Module::getModuleURL('elixir/res/img/lsaai_logo.png'); ?>"
+                 alt="Life Science Login logo">
             <div class="card-body">
                 <?php
                 if (isset($this->data['header'])) {
diff --git a/themes/elixir/elixir/disco-tpl.php b/themes/elixir/elixir/disco-tpl.php
index 1119b74..34b2a7e 100644
--- a/themes/elixir/elixir/disco-tpl.php
+++ b/themes/elixir/elixir/disco-tpl.php
@@ -15,46 +15,44 @@ if (isset($_POST['accepted'])) {
 $idpEntityId = null;
 $authContextClassRef = null;
 
-$warningAttributes = $this->data[Disco::WARNING_ATTRIBUTES];
 $continueUrl = $this->data[Disco::CONTINUE_URL];
+$warningConfiguration = $this->data[Disco::WARNING] ?? null;
 
-$preventUserContinue = WarningConfiguration::WARNING_TYPE_ERROR === $warningAttributes->getType();
-
-if (!$warningAttributes->isEnabled() || ($warningAccepted && !$preventUserContinue)) {
+if (empty($warningConfiguration) || ! $warningConfiguration->isEnabled()) {
     HTTP::redirectTrustedURL($continueUrl);
 }
 
-if ($warningAttributes->isEnabled()) {
-    $this->data['header'] = $this->t('{perun:disco:warning}');
+$preventUserContinue = WarningConfiguration::WARNING_TYPE_ERROR === $warningConfiguration->getType();
+if (!$preventUserContinue && $warningAccepted) {
+    HTTP::redirectTrustedURL($continueUrl);
 }
 
+$this->data['header'] = $this->t('{elixir:disco:warning_header}');
 $this->data['jquery'] = [
     'core' => true,
     'ui' => true,
     'css' => true,
 ];
+
 $this->includeAtTemplateBase('includes/header.php');
 
-if ($warningAttributes->isEnabled()) {
-    $this->includeInlineTranslation('{perun:disco:warning_title}', $warningAttributes->getTitle());
-    $this->includeInlineTranslation('{perun:disco:warning_text}', $warningAttributes->getText());
-    if (WarningConfiguration::WARNING_TYPE_INFO === $warningAttributes->getType()) {
-        echo '<div class="alert alert-info">';
-    } elseif (WarningConfiguration::WARNING_TYPE_WARNING === $warningAttributes->getType()) {
-        echo '<div class="alert alert-warning">';
-    } elseif (WarningConfiguration::WARNING_TYPE_ERROR === $warningAttributes->getType()) {
-        echo '<div class="alert alert-danger">';
-    }
-    echo '<h4><strong>' . $this->t('{perun:disco:warning_title}') . '</strong> </h4>';
-    echo  $this->t('{perun:disco:warning_text}');
-    echo '</div>';
-    if (!$preventUserContinue) {
-        echo '<form method="POST">';
-        echo '<input class="btn btn-lg btn-primary btn-block" type="submit" name="accepted" value="Continue" />';
-        echo '</form>';
-    }
-} else {
-    $warningAccepted = true;
+$this->includeInlineTranslation('{elixir:disco:warning_title}', $warningConfiguration->getTitle());
+$this->includeInlineTranslation('{elixir:disco:warning_text}', $warningConfiguration->getText());
+if (WarningConfiguration::WARNING_TYPE_INFO === $warningConfiguration->getType()) {
+    echo '<div class="alert alert-info">';
+} elseif (WarningConfiguration::WARNING_TYPE_WARNING === $warningConfiguration->getType()) {
+    echo '<div class="alert alert-warning">';
+} elseif (WarningConfiguration::WARNING_TYPE_ERROR === $warningConfiguration->getType()) {
+    echo '<div class="alert alert-danger">';
+}
+echo '<h4><strong>' . $this->t('{elixir:disco:warning_title}') . '</strong> </h4>';
+echo  $this->t('{elixir:disco:warning_text}');
+echo '</div>';
+if (!$preventUserContinue) {
+    echo '<form method="POST">';
+    echo '<input class="btn btn-lg btn-primary btn-block" type="submit" name="accepted" value="' .
+        $this->t('{elixir:disco:warning_continue}') . '" />';
+    echo '</form>';
 }
 
 $this->includeAtTemplateBase('includes/footer.php');
diff --git a/themes/elixir/proxystatistics/detail-tpl.php b/themes/elixir/proxystatistics/detail-tpl.php
index 2c440cc..767916a 100644
--- a/themes/elixir/proxystatistics/detail-tpl.php
+++ b/themes/elixir/proxystatistics/detail-tpl.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 use SimpleSAML\Module\elixir\stats\Templates;
 
@@ -22,8 +24,12 @@ $this->includeAtTemplateBase('includes/header-full.php');
 
     <div class="row mt-5">
         <div class="col-12">
-            <h3><?php echo $this->t('{proxystatistics:stats:' . $this->data['side'] . 'Detail_dashboard_header}'); ?></h3>
-            <p><?php echo $this->t('{proxystatistics:stats:' . $this->data['side'] . 'Detail_dashboard_legend}'); ?></p>
+            <h3>
+                <?php echo $this->t('{proxystatistics:stats:' . $this->data['side'] . 'Detail_dashboard_header}'); ?>
+            </h3>
+            <p>
+                <?php echo $this->t('{proxystatistics:stats:' . $this->data['side'] . 'Detail_dashboard_legend}'); ?>
+            </p>
         </div>
         <div class="col-12">
             <?php Templates::loginsDashboard(); ?>
@@ -32,8 +38,12 @@ $this->includeAtTemplateBase('includes/header-full.php');
 
     <div class="row mt-5 mb-4">
         <div class="col-12">
-            <h3><?php echo $this->t('{proxystatistics:stats:' . $this->data['side'] . 'Detail_graph_header}'); ?></h3>
-            <p><?php echo $this->t('{proxystatistics:stats:' . $this->data['side'] . 'Detail_graph_legend}'); ?></p>
+            <h3>
+                <?php echo $this->t('{proxystatistics:stats:' . $this->data['side'] . 'Detail_graph_header}'); ?>
+            </h3>
+            <p>
+                <?php echo $this->t('{proxystatistics:stats:' . $this->data['side'] . 'Detail_graph_legend}'); ?>
+            </p>
         </div>
         <div class="col-12">
             <div class="row">
diff --git a/themes/elixir/proxystatistics/loginsDashboard-tpl.php b/themes/elixir/proxystatistics/loginsDashboard-tpl.php
index 4b77109..a0436f6 100644
--- a/themes/elixir/proxystatistics/loginsDashboard-tpl.php
+++ b/themes/elixir/proxystatistics/loginsDashboard-tpl.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 ?>
 
diff --git a/themes/elixir/proxystatistics/providers-tpl.php b/themes/elixir/proxystatistics/providers-tpl.php
index 01a3bbc..1d26d16 100644
--- a/themes/elixir/proxystatistics/providers-tpl.php
+++ b/themes/elixir/proxystatistics/providers-tpl.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 use SimpleSAML\Module\elixir\stats\Templates;
 
diff --git a/themes/elixir/proxystatistics/summary-tpl.php b/themes/elixir/proxystatistics/summary-tpl.php
index 21b33e6..fd6b2a4 100644
--- a/themes/elixir/proxystatistics/summary-tpl.php
+++ b/themes/elixir/proxystatistics/summary-tpl.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 use SimpleSAML\Module\elixir\stats\Templates;
 use SimpleSAML\Module\proxystatistics\Config;
diff --git a/themes/elixir/proxystatistics/timeRange-tpl.php b/themes/elixir/proxystatistics/timeRange-tpl.php
index d040db2..1a8fa9d 100644
--- a/themes/elixir/proxystatistics/timeRange-tpl.php
+++ b/themes/elixir/proxystatistics/timeRange-tpl.php
@@ -1,4 +1,6 @@
-<?php declare(strict_types=1);
+<?php
+
+declare(strict_types=1);
 
 ?>
 <div class="timeRange">
-- 
GitLab