SimpleIdServer
SimpleIdServer copied to clipboard
[SCIM] BuildResult in EFSCIMExpressionLinqExtensions.cs does not always filter by given realm
When trying to use the newly introduced realm functionality I noticed that the filtering based on realm is not applied when not excluded or included attributes are passed to the endpoint.
Issue
In the lines 44 to 58 from EFSCIMExpressionLinqExtensions.cs, the below code is present.
if (filteredAttrs != null)
{
filteredAttrs = filteredAttrs.Where(a => a.RepresentationId == id);
SCIMRepresentation result = null;
if(!string.IsNullOrWhiteSpace(realm))
result = await representations.FirstOrDefaultAsync(r => r.Id == id && r.ResourceType == resourceType && r.RealmName == realm, cancellationToken);
else
result = await representations.FirstOrDefaultAsync(r => r.Id == id && r.ResourceType == resourceType, cancellationToken);
if (result == null) return null;
result.FlatAttributes = filteredAttrs.ToList();
return result;
}
return await representations.FirstOrDefaultAsync(r => r.Id == id && r.ResourceType == resourceType, cancellationToken);
The realm filter is only applied in case filteredAttrs is not null.
I am using SCIM using the EFCore configuration, and have not checked if it also occurs with other storage configurations.
Hello,
There is indeed an issue in the current implementation. 😔 I have made some changes in the "Release/5.0.3" branch to fix this issue!
KR, SID