Add some attributes to authz_eb call#2069
Conversation
Adds external Subject-id and email to the EB SRAM interrupt call
|
Wouldn't it be more future proof to simply send all attributes over to SBS? That's what we do for the AA and PDP, too. |
|
Kun je nog een Changelog entry toevoegen? |
- Remove no-op self-assignment ($attributes = $attributes;) left over from the attribute extraction refactor - Use named arguments for the AuthzRequest constructor call to reduce the risk of argument-order mistakes as the DTO grows - Extend test fixtures with subject-id and mail attributes so the new externalSubjectId/email extraction logic is actually exercised instead of only asserting on empty defaults
| continueUrl: $continueUrl, | ||
| serviceId: $serviceId, | ||
| issuerId: $issuerId, | ||
| attributes: $attributes |
There was a problem hiding this comment.
Passing the whole $attributes object as is seems weird. I think we should at least normalize it. Serializing it as is can lead to inconsistent responses in the case of attributes with Nested XML child elements or with eduPersonTargetedID which uses a NameID object.
So probably good to filter through normalize function:
// snip, removed, see comment below This will potentially drop data from the attribute response, but if that is a problem we should come up with a proper api contract, not just throw in $attributes and hope for the best.
There was a problem hiding this comment.
Checked how PDP and AA handle this:
PDP does not filter. AA filters any non-string value. So for consistency, we should mirror AA's approach:
$attributes = $this->filterNonStringValuesFromAttributes($this->getResponseAttributes());
// Filter the non string valued attributes
$attributes = self::filterNonStringValuesFromAttributes($attributes);
private static function filterNonStringValuesFromAttributes($attributes)
{
return array_filter($attributes, function ($attributeValues) {
foreach ($attributeValues as $attributeValue) {
if (!is_string($attributeValue)) {
return false; // drop the whole attribute
}
}
return true;
});
}
Adds external Subject-id and email to the EB SRAM interrupt call