Skip to content

Commit 5201839

Browse files
Ticket #917 : Return 404 (scim)
1 parent b40ed1d commit 5201839

3 files changed

Lines changed: 64 additions & 2 deletions

File tree

src/Scim/SimpleIdServer.Scim.Persistence.EF/Extensions/EFSCIMExpressionLinqExtensions.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
using System.Reflection;
1414
using System.Threading;
1515
using System.Threading.Tasks;
16-
using System.Xml.XPath;
1716

1817
namespace SimpleIdServer.Scim.Persistence.EF.Extensions
1918
{
@@ -46,6 +45,11 @@ public static async Task<SCIMRepresentation> BuildResult(
4645
{
4746
filteredAttrs = filteredAttrs.Where(a => a.RepresentationId == id);
4847
var result = await GetRepresentation(representations, id, resourceType, realm, cancellationToken);
48+
if(result == null)
49+
{
50+
return null;
51+
}
52+
4953
result.FlatAttributes = filteredAttrs.ToList();
5054
return result;
5155
}

tests/SimpleIdServer.Scim.Host.Acceptance.Tests/Features/GroupErrors.feature

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,15 @@ Scenario: Check group cannot have a self reference
1616
And extract JSON from body
1717

1818
Then HTTP status code equals to '500'
19-
Then JSON 'detail'='Representation cannot have a self reference'
19+
Then JSON 'detail'='Representation cannot have a self reference'
20+
21+
Scenario: When group doesn't exist and the parameter exclusedAttributes is passed into the request then an error 404 is returned
22+
When execute HTTP GET request 'http://localhost/Groups/invalid?excludedAttributes=members'
23+
24+
And extract JSON from body
25+
26+
Then HTTP status code equals to '404'
27+
Then JSON 'status'='404'
28+
Then JSON 'schemas[0]'='urn:ietf:params:scim:api:messages:2.0:Error'
29+
Then JSON 'scimType'='unknown'
30+
Then JSON 'detail'='resource invalid not found'

tests/SimpleIdServer.Scim.Host.Acceptance.Tests/Features/GroupErrors.feature.cs

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)