Giter Club home page Giter Club logo

Comments (4)

simpleidserver avatar simpleidserver commented on May 16, 2024 1

Indeed it seems to be an issue. We will take a closer look and fix this issue.
Thank you for you feedback !

from simpleidserver.

simpleidserver avatar simpleidserver commented on May 16, 2024 1

The issue is fixed : e7c5f61

from simpleidserver.

simpleidserver avatar simpleidserver commented on May 16, 2024

Hi,

The "id" attribute is mandatory and must be present in all SCIM representations for example : Users or Groups.
The class "AttributeReferenceEnricher" is used to add mandatory fields like "id", "display" or "$ref" into SCIM representations.
Those mandatory attributes are "normally" not inserted into sub complex attributes like "user\emails".

When a user is added :


POST http://localhost:60002/Users HTTP/1.1
User-Agent: Fiddler
Content-Type: application/json
Host: localhost:60002
Content-Length: 416

{
 "schemas": [ "urn:ietf:params:scim:schemas:core:2.0:User", "urn:ietf:params:scim:schemas:extension:eid:2.0:User"],
 "userName": "loki3",
 "externalId": "externalId2",
 "name": { "formatted" : "formatted", "familyName": "familyName", "givenName": "givenName" },
"phoneNumbers": [ { "type": "mobile", "value": "01" }, { "type": "home", "value": "02" } ],
"validity": "22",
"birthDate": "25-09-20 13:35:33"
}

The following result is received :

HTTP/1.1 201 Created
Date: Sun, 04 Oct 2020 16:53:21 GMT
Content-Type: application/scim+json
Server: Kestrel
Content-Length: 850
ETag: 76840920-7b48-4393-aaea-18b4678cc3bb
Location: http://localhost:60002/Users/53d7ef94-99b9-4f6b-93f2-f1ff3fb9dc70

{
  "id": "53d7ef94-99b9-4f6b-93f2-f1ff3fb9dc70",
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:User",
    "urn:ietf:params:scim:schemas:extension:eid:2.0:User"
  ],
  "meta": {
    "resourceType": "Users",
    "created": "2020-10-04T16:53:21.2108435Z",
    "lastModified": "2020-10-04T16:53:21.2108436Z",
    "version": "76840920-7b48-4393-aaea-18b4678cc3bb",
    "location": "http://localhost:60002/Users/53d7ef94-99b9-4f6b-93f2-f1ff3fb9dc70"
  },
  "externalId": "externalId2",
  "userName": "loki3",
  "name": {
    "formatted": "formatted",
    "familyName": "familyName",
    "givenName": "givenName"
  },
  "phoneNumbers": [
    {
      "type": "mobile",
      "value": "01"
    },
    {
      "type": "home",
      "value": "02"
    }
  ],
  "validity": 22.0,
  "birthDate": "2020-09-25T13:35:33"
}

When the new user is fetched :

GET http://localhost:60002/Users/53d7ef94-99b9-4f6b-93f2-f1ff3fb9dc70 HTTP/1.1
User-Agent: Fiddler
Content-Type: application/json

The following result is returned :

HTTP/1.1 200 OK
Date: Sun, 04 Oct 2020 16:53:55 GMT
Content-Type: application/scim+json
Server: Kestrel
Content-Length: 849
ETag: 76840920-7b48-4393-aaea-18b4678cc3bb
Location: http://localhost:60002/Users/53d7ef94-99b9-4f6b-93f2-f1ff3fb9dc70

{
  "id": "53d7ef94-99b9-4f6b-93f2-f1ff3fb9dc70",
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:User",
    "urn:ietf:params:scim:schemas:extension:eid:2.0:User"
  ],
  "meta": {
    "resourceType": "Users",
    "created": "2020-10-04T16:53:21.2108435",
    "lastModified": "2020-10-04T16:53:21.2108436",
    "version": "76840920-7b48-4393-aaea-18b4678cc3bb",
    "location": "http://localhost:60002/Users/53d7ef94-99b9-4f6b-93f2-f1ff3fb9dc70"
  },
  "externalId": "externalId2",
  "userName": "loki3",
  "birthDate": "2020-09-25T13:35:33",
  "phoneNumbers": [
    {
      "type": "home",
      "value": "02"
    },
    {
      "value": "01",
      "type": "mobile"
    }
  ],
  "name": {
    "givenName": "givenName",
    "formatted": "formatted",
    "familyName": "familyName"
  },
  "validity": 22.00
}

The "id" is not inserted into sub complex attributes (user\phoneNumbers).
I couldn't reproduce the error.

from simpleidserver.

sviatoslav-vilkovych avatar sviatoslav-vilkovych commented on May 16, 2024

I don't know about the user\phoneNumbers, but I know that for user\groups I am getting "id" instead of "value", while I am setting "value".

    private IEnumerable<SCIMRepresentationAttribute> FillComplexGroupsAttribute(SCIMSchemaAttribute groupsAttribute, IEnumerable<ScimGroup> scimGroups)
    {
        var valueSubAttributeOfGroups = groupsAttribute.SubAttributes.Single(attr => attr.Name == ValueAttributeName);
        var refSubAttributeOfGroups = groupsAttribute.SubAttributes.Single(attr => attr.Name == RefAttributeName);
        var displaySubAttributeOfGroups = groupsAttribute.SubAttributes.Single(attr => attr.Name == DisplayAttributeName);

        var groupsScimAttributes = new List<SCIMRepresentationAttribute>();
        foreach (var group in scimGroups)
        {
            groupsScimAttributes.Add(new SCIMRepresentationAttribute(groupsAttribute.Id, groupsAttribute)
            {
                Values = new List<SCIMRepresentationAttribute>()
                {
                    new SCIMRepresentationAttribute(valueSubAttributeOfGroups.Id,
                                                    valueSubAttributeOfGroups,
                                                    valuesString: new List<string> { group.ObjectGuid }),
                    new SCIMRepresentationAttribute(displaySubAttributeOfGroups.Id,
                                                    displaySubAttributeOfGroups,
                                                    valuesString: new List<string> { group.DisplayName }),
                    new SCIMRepresentationAttribute(refSubAttributeOfGroups.Id,
                                                    refSubAttributeOfGroups,
                                                    valuesString: new List<string> { $"{Url}/{SCIMEndpoints.Group}/{group.ObjectGuid}" }),
                },
            });
        }

        return groupsScimAttributes;
    }

Imagine having IEnumerable<SCIMRepresentation> of users with groups filled with something like this. Then, during obtaining concrete user you will get a model with "id" because it goes through your Enricher model and won't have a "value" attribute, while the model that will be returned after changing the user will return the model with "value" because it goes through CommandHandler and I am setting all the fields.
And it wouldn't be a problem, but I can't do something like this:

var valueSubAttributeOfGroups = groupsAttribute.SubAttributes.Single(attr => attr.Name == "id");

Groups attribute does not have an "id" subattribute.

from simpleidserver.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.