Skip to content

Commit

Permalink
add some more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
w-ensink committed Dec 2, 2024
1 parent 60655c1 commit a4c2c49
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ function map_saml_attributes($saml_attributes) {
global $MAP_IRMA_SAML_ATTRIBUTES;
$irma_attributes = [];
foreach ($MAP_IRMA_SAML_ATTRIBUTES as $irma_key => $saml_key) {
$file = "/var/simplesamlphp/log/caesar.log";
file_put_contents($file, "52: " .. json_encode($saml_key, JSON_PRETTY_PRINT), FILE_APPEND);

$value = NULL;
if (isset($saml_attributes[$saml_key]) &&
count($saml_attributes[$saml_key]) > 0 &&
$saml_attributes[$saml_key] !== NULL) {
$value = $saml_attributes[$saml_key][0];
file_put_contents($file, "59: " .. $irma_key .. ", " .. $value, FILE_APPEND);
}
if ($irma_key === 'dateofbirth') {
if (preg_match('#^[0-9]{2}/[0-9]{2}/[0-9]{4}$#', $value)) {
Expand All @@ -62,8 +66,12 @@ function map_saml_attributes($saml_attributes) {
if ($value === NULL)
$value = ' '; // Fallback to old solution for absent attributes: dateofbirth is not (yet) optional :(
}
if ($value !== NULL)
if ($value !== NULL) {
$irma_attributes[$irma_key] = $value;
file_put_contents($file, "71: " .. $irma_key .. ", " .. $value, FILE_APPEND);
} else {
file_put_contents($file, "73: " .. $irma_key .. ", " .. $value .. " = NULL", FILE_APPEND);
}
}

// Add profileurl from username
Expand Down

0 comments on commit a4c2c49

Please sign in to comment.