From c75b81bf6d72ef2ee0382725a1a798d8f4fe8d84 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Mon, 4 Feb 2019 11:57:34 +0100
Subject: [PATCH] Fixes for modules/multiauth

---
 modules/multiauth/lib/Auth/Source/MultiAuth.php | 17 ++++++++++++++++-
 modules/multiauth/www/selectsource.php          |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/modules/multiauth/lib/Auth/Source/MultiAuth.php b/modules/multiauth/lib/Auth/Source/MultiAuth.php
index c25f85ba5..185ccb46b 100644
--- a/modules/multiauth/lib/Auth/Source/MultiAuth.php
+++ b/modules/multiauth/lib/Auth/Source/MultiAuth.php
@@ -9,7 +9,6 @@ namespace SimpleSAML\Module\multiauth\Auth\Source;
  * @author Lorenzo Gil, Yaco Sistemas S.L.
  * @package SimpleSAMLphp
  */
-
 class MultiAuth extends \SimpleSAML\Auth\Source
 {
     /**
@@ -42,6 +41,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source
      */
     private $preselect;
 
+
     /**
      * Constructor for this authentication source.
      *
@@ -111,6 +111,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source
         }
     }
 
+
     /**
      * Prompt the user with a list of authentication sources.
      *
@@ -122,6 +123,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source
      * in the delegateAuthentication method.
      *
      * @param array &$state Information about the current authentication.
+     * @return void
      */
     public function authenticate(&$state)
     {
@@ -154,6 +156,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source
         assert(false);
     }
 
+
     /**
      * Delegate authentication.
      *
@@ -164,6 +167,8 @@ class MultiAuth extends \SimpleSAML\Auth\Source
      *
      * @param string $authId Selected authentication source
      * @param array $state Information about the current authentication.
+     * @return void
+     * @throws \Exception
      */
     public static function delegateAuthentication($authId, $state)
     {
@@ -172,6 +177,10 @@ class MultiAuth extends \SimpleSAML\Auth\Source
 
         $as = \SimpleSAML\Auth\Source::getById($authId);
         $valid_sources = array_map(
+            /**
+             * @param array $src
+             * @return string
+             */
             function ($src) {
                 return $src['source'];
             },
@@ -201,6 +210,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source
         \SimpleSAML\Auth\Source::completeAuth($state);
     }
 
+
     /**
      * Log out from this authentication source.
      *
@@ -208,6 +218,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source
      * session and then call the logout method on it.
      *
      * @param array &$state Information about the current logout operation.
+     * @return void
      */
     public function logout(&$state)
     {
@@ -225,6 +236,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source
         $source->logout($state);
     }
 
+
     /**
      * Set the previous authentication source.
      *
@@ -232,6 +244,7 @@ class MultiAuth extends \SimpleSAML\Auth\Source
      * by storing its name in a cookie.
      *
      * @param string $source Name of the authentication source the user selected.
+     * @return void
      */
     public function setPreviousSource($source)
     {
@@ -251,11 +264,13 @@ class MultiAuth extends \SimpleSAML\Auth\Source
         \SimpleSAML\Utils\HTTP::setCookie($cookieName, $source, $params, false);
     }
 
+
     /**
      * Get the previous authentication source.
      *
      * This method retrieves the authentication source that the user selected
      * last time or NULL if this is the first time or remembering is disabled.
+     * @return string|null
      */
     public function getPreviousSource()
     {
diff --git a/modules/multiauth/www/selectsource.php b/modules/multiauth/www/selectsource.php
index 287f7808e..f18d60fbe 100644
--- a/modules/multiauth/www/selectsource.php
+++ b/modules/multiauth/www/selectsource.php
@@ -19,6 +19,7 @@ $state = \SimpleSAML\Auth\State::loadState($authStateId, \SimpleSAML\Module\mult
 
 if (array_key_exists("\SimpleSAML\Auth\Source.id", $state)) {
     $authId = $state["\SimpleSAML\Auth\Source.id"];
+    /** @var \SimpleSAML\Module\multiauth\Auth\Source\MultiAuth $as */
     $as = \SimpleSAML\Auth\Source::getById($authId);
 } else {
     $as = null;
-- 
GitLab