Skip to content
Snippets Groups Projects
Unverified Commit 39090b9a authored by Pavel Břoušek's avatar Pavel Břoušek Committed by GitHub
Browse files

Merge pull request #44 from CESNET/melanger-patch-1

fix: prevent empty mfaTokens
parents c236355b 7a85d9bf
No related branches found
No related tags found
No related merge requests found
...@@ -68,7 +68,6 @@ class GetMfaTokensPrivacyIDEA extends \SimpleSAML\Auth\ProcessingFilter ...@@ -68,7 +68,6 @@ class GetMfaTokensPrivacyIDEA extends \SimpleSAML\Auth\ProcessingFilter
public function process(&$state) public function process(&$state)
{ {
$state[Authswitcher::PRIVACY_IDEA_FAIL] = false; $state[Authswitcher::PRIVACY_IDEA_FAIL] = false;
$state['Attributes'][$this->tokens_attr] = [];
$admin_token = $this->getAdminToken(); $admin_token = $this->getAdminToken();
if (empty($admin_token)) { if (empty($admin_token)) {
$state[AuthSwitcher::PRIVACY_IDEA_FAIL] = true; $state[AuthSwitcher::PRIVACY_IDEA_FAIL] = true;
...@@ -165,14 +164,18 @@ class GetMfaTokensPrivacyIDEA extends \SimpleSAML\Auth\ProcessingFilter ...@@ -165,14 +164,18 @@ class GetMfaTokensPrivacyIDEA extends \SimpleSAML\Auth\ProcessingFilter
private function saveTokensToStateAttributes(&$state, $tokens) private function saveTokensToStateAttributes(&$state, $tokens)
{ {
$types = [];
foreach ($tokens as $token) { foreach ($tokens as $token) {
foreach ($this->tokens_type as $type) { foreach ($this->tokens_type as $type) {
if ($token['tokentype'] === strtolower($type)) { if ($token['tokentype'] === strtolower($type)) {
$token[$this->token_type_attr] = $type; $token[$this->token_type_attr] = $type;
$state['Attributes'][$this->tokens_attr][] = $token; $types[] = $token;
break; break;
} }
} }
} }
if (!empty($types)) {
$state['Attributes'][$this->tokens_attr] = $types;
}
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment