From b0a76e817c8e43cc1a9cd9187d2a1ce874ad7b1f Mon Sep 17 00:00:00 2001 From: Arjen van Bochoven Date: Thu, 13 Feb 2020 18:00:03 +0100 Subject: [PATCH] Saml fix (#1315) * Replace commas with _ in SAML groups * Pass group array by reference --- app/lib/munkireport/AuthSaml.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/lib/munkireport/AuthSaml.php b/app/lib/munkireport/AuthSaml.php index 9d6e8d175..e4040d02b 100644 --- a/app/lib/munkireport/AuthSaml.php +++ b/app/lib/munkireport/AuthSaml.php @@ -249,6 +249,9 @@ private function mapSamlAttrs($attrs) } } + // Make group names compliant + $this->_dirify($out['groups']); + // Check if we have a user if( $this->debug() && ! $out['user'] ) { @@ -259,6 +262,14 @@ private function mapSamlAttrs($attrs) return $out; } + // Replace comma with _ + private function _dirify(Array &$array) + { + array_walk($array, function(&$value, $key){ + $value = str_replace(',', '_', $value); + }); + } + private function debug() { return isset($this->config['debug']) && $this->config['debug'] == true;