当我按照WSO2 SCIM 2.0 REST端点(https://docs.wso2.com/display/IS560/apidocs/SCIM2-endpoints/index.html#!/operations#UsersEndpoint#getUser)通过某些多值属性(例如电子邮件)搜索用户时。 WSO2身份服务器(v5.7.0)返回空结果。这样的过滤器字符串-filter = emails.value co abc@abc.com。根据{{3}},语法似乎不错。
curl -v -k --user:http://www.simplecloud.info/specs/draft-scim-api-00.html#query-resources
响应: {“ totalResults”:0,“ startIndex”:1,“ itemsPerPage”:0,“ schemas”:[“ urn:ietf:params:scim:api:messages:2.0:ListResponse”] < / p>
答案 0 :(得分:0)
我们需要放置在创建用户时曾经定义的“ email。<< em>类型名称>”,而不是“ emails.value”。电子邮件是一个多值属性,因此您可以添加您的类型并为其存储值。假设在这里我按如下方式创建用户,
请求:
curl -v -k --user admin:admin --data '{"schemas":[],"name":{"familyName":"jackson","givenName":"kim"},"userName":"kim","password":"kimwso2","emails":[{"value":"kim_j@wso2.com","type":"work"}]}' --header "Content-Type:application/json" https://localhost:9443/scim2/Users
响应:
{"emails":[{"type":"work","value":"kim_j@wso2.com"}],"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"}
现在让我们过滤多值属性电子邮件
请求:
curl -v -k --user admin:admin https://localhost:9443/scim2/Users?filter=emails.work+co+kim
响应:
{"totalResults":1,"startIndex":1,"itemsPerPage":1,"schemas":["urn:ietf:params:scim:api:messages:2.0:ListResponse"],"Resources":[{"emails":[{"type":"work","value":"kim_j@wso2.com"}],"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"}]}
有关更多信息,请参见此处的documentation。