Youfa Mao
Youfa Mao

Reputation: 159

WSO2 SCIM 2.0 query filter - multi-value search is not supported. e.g. filter=emails.value co richard01

when I follow the WSO2 SCIM 2.0 REST Endpoint(https://docs.wso2.com/display/IS560/apidocs/SCIM2-endpoints/index.html#!/operations#UsersEndpoint#getUser) to search user by some multi-value attribute(e.g. emails). The WSO2 identity server(v5.7.0) returns empty result. The filter string like this -filter=emails.value co [email protected]. According to http://www.simplecloud.info/specs/draft-scim-api-00.html#query-resources, the syntax seems good.

curl -v -k --user : https://localhost:9444/scim2/Users?filter=emails.value+co+richard01

the response: {"totalResults":0,"startIndex":1,"itemsPerPage":0,"schemas":["urn:ietf:params:scim:api:messages:2.0:ListResponse"]

Upvotes: 0

Views: 1630

Answers (1)

Sarubi
Sarubi

Reputation: 66

Instead of putting as "emails.value" we need to put "email.<type-name>" which we used to defined when we were creating the user. Email is a multi-valued attribute, so you can add your type and store the value for it. Let's assume here I'm creating the user as follows,

Request:

curl -v -k --user admin:admin --data '{"schemas":[],"name":{"familyName":"jackson","givenName":"kim"},"userName":"kim","password":"kimwso2","emails":[{"value":"[email protected]","type":"work"}]}' --header "Content-Type:application/json" https://localhost:9443/scim2/Users

Response:

{"emails":[{"type":"work","value":"[email protected]"}],"meta":{"created":"2019-03-26T15:18:47Z","location":"https://localhost:9443/scim2/Users/c40fe2f2-d9c1-4555-a1d1-e6ff3dde9d41","lastModified":"2019-03-26T15:18:47Z","resourceType":"User"},"schemas":["urn:ietf:params:scim:schemas:core:2.0:User","urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"],"name":{"familyName":"jackson","givenName":"kim"},"id":"c40fe2f2-d9c1-4555-a1d1-e6ff3dde9d41","userName":"kim"}

Now let's filter the multi-valued attribute email,

Request:

curl -v -k --user admin:admin https://localhost:9443/scim2/Users?filter=emails.work+co+kim

Response:

{"totalResults":1,"startIndex":1,"itemsPerPage":1,"schemas":["urn:ietf:params:scim:api:messages:2.0:ListResponse"],"Resources":[{"emails":[{"type":"work","value":"[email protected]"}],"meta":{"created":"2019-03-26T15:18:47Z","location":"https://localhost:9443/scim2/Users/c40fe2f2-d9c1-4555-a1d1-e6ff3dde9d41","lastModified":"2019-03-26T15:18:47Z","resourceType":"User"},"roles":[{"type":"default","value":"Internal/everyone"}],"name":{"givenName":"kim","familyName":"jackson"},"id":"c40fe2f2-d9c1-4555-a1d1-e6ff3dde9d41","userName":"kim"}]}

For more information refer to the documentation here.

Upvotes: 2

Related Questions