diff --git a/lib/Auth/Process/GetMfaTokensPrivacyIDEA.php b/lib/Auth/Process/GetMfaTokensPrivacyIDEA.php index 71f438fbdb3edbe1999393ebb12736875743ac92..d3c2b556ad5a498e1b35368966e296aea48c7e0e 100644 --- a/lib/Auth/Process/GetMfaTokensPrivacyIDEA.php +++ b/lib/Auth/Process/GetMfaTokensPrivacyIDEA.php @@ -68,7 +68,6 @@ class GetMfaTokensPrivacyIDEA extends \SimpleSAML\Auth\ProcessingFilter public function process(&$state) { $state[Authswitcher::PRIVACY_IDEA_FAIL] = false; - $state['Attributes'][$this->tokens_attr] = []; $admin_token = $this->getAdminToken(); if (empty($admin_token)) { $state[AuthSwitcher::PRIVACY_IDEA_FAIL] = true; @@ -165,14 +164,18 @@ class GetMfaTokensPrivacyIDEA extends \SimpleSAML\Auth\ProcessingFilter private function saveTokensToStateAttributes(&$state, $tokens) { + $types = []; foreach ($tokens as $token) { foreach ($this->tokens_type as $type) { if ($token['tokentype'] === strtolower($type)) { $token[$this->token_type_attr] = $type; - $state['Attributes'][$this->tokens_attr][] = $token; + $types[] = $token; break; } } } + if (!empty($types)) { + $state['Attributes'][$this->tokens_attr] = $types; + } } }