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

fix: prevent empty mfaTokens

a filter for adding attributes from LDAP has problem with empty attributes
parent c236355b
No related branches found
No related tags found
1 merge request!44fix: prevent empty mfaTokens
......@@ -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;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment