How to create users in WSO2 IS via SCIM2 API with external claims

I'am try to create user with external claims via scim2 api. First i create claim http://wso2.org/claims/inn Creating claim

Then i add claim to schema: urn:ietf:params:scim:schemas:extension:enterprise:2.0:User add schema claim

Finaly i sending request to create user:

{
    "schemas": ["urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"],
    "name": {
        "familyName": "TryAddClaims",
        "givenName": "[email protected]"
    },
    "userName": "[email protected]",
    "password": "admin",
    "emails": [{
            "primary": true,
            "value": "[email protected]",
            "type": "home"
        }
    ],
    "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User":{
        "organization": "rest_organization",
        "inn": "inn"
    }
}

response:

{
    "emails": [
        {
            "type": "home",
            "value": "[email protected]"
        },
        "[email protected]"
    ],
    "meta": {
        "created": "2022-09-12T07:43:20.474255Z",
        "location": "my-host/scim2/Users/1d64942c-ce24-48cf-ad47-665f4f9c37f8",
        "lastModified": "2022-09-12T07:43:20.474255Z",
        "resourceType": "User"
    },
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:User",
        "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
    ],
    "roles": [
        {
            "type": "default",
            "value": "Internal/everyone"
        },
        {
            "display": "everyone"
        }
    ],
    "name": {
        "givenName": "[email protected]",
        "familyName": "TryAddClaims"
    },
    "id": "1d64942c-ce24-48cf-ad47-665f4f9c37f8",
    "userName": "[email protected]",
    "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
        "organization": "rest_organization"
    }
}

why inn not present in the response, but organization with same config is present? In wso2 admin panel inn also empty for this user.

Upvotes: -1

Views: 181

Answers (1)

Anuradha Karunarathna
Anuradha Karunarathna

Reputation: 3057

Seems you have missed adding attribute definition to the scim2-schema-extension.config file located in the <IS_HOME>/repository/conf/ folder.

Check Add an Attribute Definition section in https://medium.com/p/71621f62c5d3 or Refer to the official documentation: https://is.docs.wso2.com/en/5.9.0/develop/extending-scim2-user-schemas/#extending-the-scim-20-api

Upvotes: 4

Related Questions