From 57740964c01be0daff4a73b0fadfca8110998894 Mon Sep 17 00:00:00 2001
From: Tim van Dijen <tvdijen@gmail.com>
Date: Sun, 3 Feb 2019 17:30:05 +0100
Subject: [PATCH] Fixes for modules/authX509

---
 modules/authX509/lib/Auth/Process/ExpiryWarning.php |  5 ++++-
 modules/authX509/lib/Auth/Source/X509userCert.php   | 11 +++++++----
 modules/authX509/templates/X509error.php            |  1 +
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/modules/authX509/lib/Auth/Process/ExpiryWarning.php b/modules/authX509/lib/Auth/Process/ExpiryWarning.php
index 1b9c1ca87..9ef69aeb9 100644
--- a/modules/authX509/lib/Auth/Process/ExpiryWarning.php
+++ b/modules/authX509/lib/Auth/Process/ExpiryWarning.php
@@ -19,8 +19,10 @@ namespace SimpleSAML\Module\authX509\Auth\Process;
 
 class ExpiryWarning extends \SimpleSAML\Auth\ProcessingFilter
 {
-
+    /** @var int */
     private $warndaysbefore = 30;
+
+    /** @var string|null */
     private $renewurl = null;
 
     /**
@@ -57,6 +59,7 @@ class ExpiryWarning extends \SimpleSAML\Auth\ProcessingFilter
      * is informed about the expiry date of his/her certificate.
      *
      * @param array $state  The state of the response.
+     * @return void
      */
     public function process(&$state)
     {
diff --git a/modules/authX509/lib/Auth/Source/X509userCert.php b/modules/authX509/lib/Auth/Source/X509userCert.php
index 4605c0ee9..7739cbdb7 100644
--- a/modules/authX509/lib/Auth/Source/X509userCert.php
+++ b/modules/authX509/lib/Auth/Source/X509userCert.php
@@ -13,18 +13,21 @@ class X509userCert extends \SimpleSAML\Auth\Source
 {
     /**
      * x509 attributes to use from the certificate for searching the user in the LDAP directory.
+     * @var array
      */
     private $x509attributes = ['UID' => 'uid'];
 
 
     /**
      * LDAP attribute containing the user certificate.
+     * This can be set to NULL to avoid looking up the certificate in LDAP
+     * @var array|null
      */
     private $ldapusercert = ['userCertificate;binary'];
 
 
     /**
-     * LDAPConfigHelper object
+     * @var \SimpleSAML\Module\ldap\ConfigHelper
      */
     private $ldapcf;
 
@@ -56,8 +59,6 @@ class X509userCert extends \SimpleSAML\Auth\Source
             $config,
             'Authentication source '.var_export($this->authId, true)
         );
-
-        return;
     }
 
 
@@ -67,6 +68,7 @@ class X509userCert extends \SimpleSAML\Auth\Source
      * This function can be overloaded by a child authentication class that wish to perform some operations on failure.
      *
      * @param array &$state Information about the current authentication.
+     * @return void
      */
     public function authFailed(&$state)
     {
@@ -89,6 +91,7 @@ class X509userCert extends \SimpleSAML\Auth\Source
      * page. On failure, The authX509:X509error.php template is loaded.
      *
      * @param array &$state Information about the current authentication.
+     * @return void
      */
     public function authenticate(&$state)
     {
@@ -199,12 +202,12 @@ class X509userCert extends \SimpleSAML\Auth\Source
      * This function can be overloaded by a child authentication class that wish to perform some operations after login.
      *
      * @param array &$state Information about the current authentication.
+     * @return void
      */
     public function authSuccesful(&$state)
     {
         \SimpleSAML\Auth\Source::completeAuth($state);
 
         assert(false); // should never be reached
-        return;
     }
 }
diff --git a/modules/authX509/templates/X509error.php b/modules/authX509/templates/X509error.php
index b7f8d4280..5db087b3a 100644
--- a/modules/authX509/templates/X509error.php
+++ b/modules/authX509/templates/X509error.php
@@ -1,4 +1,5 @@
 <?php
+
 $this->data['header'] = $this->t('{authX509:X509error:certificate_header}');
 
 $this->includeAtTemplateBase('includes/header.php');
-- 
GitLab