Skip to content
Snippets Groups Projects
Commit 2a377f72 authored by Jaime Pérez's avatar Jaime Pérez
Browse files

bugfix: Make sure empty strings are not acceptable for NameID generation.

This resolves #519.
parent 5923b743
No related branches found
No related tags found
No related merge requests found
......@@ -67,6 +67,15 @@ class sspmod_saml_Auth_Process_AttributeNameID extends sspmod_saml_BaseNameIDGen
}
$value = array_values($state['Attributes'][$this->attribute]); // just in case the first index is no longer 0
$value = $value[0];
if (empty($value)) {
SimpleSAML\Logger::warning(
'Empty value in attribute '.var_export($this->attribute, true).
' on user - not generating persistent NameID.'
);
return null;
}
return $value;
}
......
......@@ -77,6 +77,14 @@ class sspmod_saml_Auth_Process_PersistentNameID extends sspmod_saml_BaseNameIDGe
$uid = array_values($state['Attributes'][$this->attribute]); // just in case the first index is no longer 0
$uid = $uid[0];
if (empty($uid)) {
SimpleSAML\Logger::warning(
'Empty value in attribute '.var_export($this->attribute, true).
' on user - not generating persistent NameID.'
);
return null;
}
$secretSalt = SimpleSAML\Utils\Config::getSecretSalt();
$uidData = 'uidhashbase'.$secretSalt;
......
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