question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to add custom schemas at startup

See original GitHub issue

I’ve tried using the suggested SCIMSchemaBuilder helper and .AddSchemas() in order to add a custom schema at startup, but I’m still getting a

schemas are unknown

scim error response when I try to use the schema I defined. Any idea what I might be doing wrong?

My code:

`List<SCIMSchema> customSchemas = new List<SCIMSchema>(); var dog = SimpleIdServer.Scim.Builder.SCIMSchemaBuilder.Create(“urn:dog”) .AddStringAttribute(“name”) .AddStringAttribute(“breed”) .Build(); customSchemas.Add(dog);

        services.AddSIDScim(_ =>
        {
            _.IgnoreUnsupportedCanonicalValues = false;
        }).AddSchemas(customSchemas);

        var schemas = new List<SCIMSchema>
        {
            userSchema,
            groupSchema
        };
        services.AddScimStoreMongoDB(opt =>
        {
            opt.ConnectionString = "mongodb://localhost:27017";
            opt.Database = databaseName;

            opt.CollectionMappings = "mappings";
            opt.CollectionRepresentations = "representations";
            opt.CollectionSchemas = "schemas";
        }, schemas,
        new List<SCIMAttributeMapping>
        {
            new SCIMAttributeMapping
            {
                Id = Guid.NewGuid().ToString(),
                SourceResourceType = SCIMConstants.StandardSchemas.UserSchema.ResourceType,
                SourceAttributeSelector = "groups",
                TargetResourceType = SCIMConstants.StandardSchemas.GroupSchema.ResourceType,
                TargetAttributeId = groupSchema.Attributes.First(a => a.Name == "members").SubAttributes.First(a => a.Name == "value").Id
            }
        });`

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Shgb1618commented, Jun 10, 2020

Thanks, I appreciate the help. I have just one last question: With my currect configuration when I try to POST an enterprise user, I’m getting a schema unknown error. Is there something I need to do to enable the enterprise:2.0:User extension?

0reactions
simpleidservercommented, Jun 11, 2020

The sample project “src\Scim\SimpleIdServer.Scim.Startup” has been updated and the schema “urn:ietf:params:scim:schemas:extension:enterprise:2.0:User” is defined as an extension schema : https://github.com/simpleidserver/SimpleIdServer/tree/master/src/Scim/SimpleIdServer.Scim.Startup

Now the “User” resource has 2 schemas “urn:ietf:params:scim:schemas:core:2.0:User” and “urn:ietf:params:scim:schemas:extension:enterprise:2.0:User”. Can you execute the sample project “src\Scim\SimpleIdServer.Scim.Startup” and post the following HTTP POST request to create a user ?

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

{
   "schemas":["urn:ietf:params:scim:schemas:core:2.0:User", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"],
   "userName":"bjensen",
   "externalId":"bjensen",
   "name":{
     "formatted":"Ms. Barbara J Jensen III",
     "familyName":"Jensen",
     "givenName":"Barbara"
   },
  "employeeNumber": "123456"
 }

You should receive a response like this:

HTTP/1.1 201 Created
Date: Thu, 11 Jun 2020 18:39:29 GMT
Content-Type: application/scim+json
Server: Kestrel
Content-Length: 689
ETag: 0f2bbbe3-1c88-4bb1-b2f2-6099863723e0
Location: http://localhost:60002/Users/733fe63d-0529-4c6c-b2cb-5ddd6f78a103

{
  "id": "733fe63d-0529-4c6c-b2cb-5ddd6f78a103",
  "schemas": [
    "urn:ietf:params:scim:schemas:core:2.0:User",
    "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
  ],
  "meta": {
    "resourceType": "Users",
    "created": "2020-06-11T18:39:29.7132463Z",
    "lastModified": "2020-06-11T18:39:29.7133267Z",
    "version": "0f2bbbe3-1c88-4bb1-b2f2-6099863723e0",
    "location": "http://localhost:60002/Users/733fe63d-0529-4c6c-b2cb-5ddd6f78a103"
  },
  "externalId": "bjensen",
  "userName": "bjensen",
  "name": {
    "formatted": "Ms. Barbara J Jensen III",
    "familyName": "Jensen",
    "givenName": "Barbara"
  },
  "employeeNumber": "123456"
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - app.config configSections custom settings can not find ...
1 Answer 1 ... Try linking the app.config file to the corresponding schema (ussually you can find it on C:\Program Files\Microsoft Visual Studio...
Read more >
BUG]: Custom Connector, GetIdentities unable to resolve ...
Describe the issue The GetIdenties action on Azure DevOps custom connector is showing error "Unable to resolve schema" in Definitions tab.
Read more >
Deploy to custom schemas & override dbt defaults - YouTube
0:44 - Explain demo scenario 1:55 - Add config to project 2:30 ... How to Deploy To A Custom Schema | dbt labs...
Read more >
ERROR: no schema has been selected to create in
I had pgdump file with creating functions in custom schema and I ... But only the owner of the database will be able...
Read more >
Bug: Unable to open Revit 2019 model after saving custom ...
For my addin I want to save data into the project information of the document using a custom schema. This is generated using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found