WSO2 身份服务器:phone 使用 SCIM 的字段不接受数字
WSO2 identity server: phone fields using SCIM don't accept numbers
我在 mysql 上使用用户存储的 wso2 身份服务器版本 5.0.0。
当我尝试使用 phone 号码插入用户时,phone 号码未存储。
curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim@aaaa.it" ,"phoneNumbers":[{"value":"8811","type":"work"},{"value":"3473344555","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
结果是:
Connection #0 to host localhost left intact
{"id":"f6ce5310-a2ee-4976-9579-0299029183bb","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","phoneNumbers":[{"type":"work"},{"type":"mobile"}],"emails":"rossim@aaaa.it","meta":{"lastModified":"2015-08-19T16:09:50","location":"https://192.168.3.43:9443/wso2/scim/Users/f6ce5310-a2ee-4976-9579-0299029183bb","created":"2015-08-19T16:09:50"}}
如果我在 phone 数字中放入一个字符,它工作正常:
curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim@aaaa.it" ,"phoneNumbers":[{"value":"_8811","type":"work"},{"value":"_3473344555","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
结果是:
Connection #0 to host localhost left intact
{"id":"3ce83aca-6f70-4274-a2c3-5429132d6001","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","phoneNumbers":[{"value":"_8811","type":"work"},{"value":"_3473344555","type":"mobile"}],"emails":"rossim@aaaa.it","meta":{"lastModified":"2015-08-19T16:12:50","location":"https://192.168.3.43:9443/wso2/scim/Users/3ce83aca-6f70-4274-a2c3-5429132d6001","created":"2015-08-19T16:12:50"}}
为什么?一个 phone 数字...是一个数字!
Phone 在反斜杠内输入数字可以存储数字。示例:\"3473344555\"
请找到可以正常工作的修改后的 curl 命令。
curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim@aaaa.it","phoneNumbers" :[{"value":\"8811\","type":"work"},{"value":\"3473344555\","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
结果:
{"id":"a5520dfc-aa7c-4b4b-aba2-57df7b87e2e4","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":
"rossiusr","phoneNumbers":[{"value":"8811","type":"work"},{"value":"3473344555","type":"mobile"}],"emails":"rossim@aaaa.it","meta":{"lastModified"
:"2016-01-19T11:04:32","location":"https://localhost:9443/wso2/scim/Users/a5520dfc-aa7c-4b4b-aba2-57df7b87e2e4","created":"2016-01-19T11:04:32"}}*
到主机 localhost 的连接 #0 完好无损
这是一个 CURL POST 请求示例要将批量用户添加到 WSO2 身份服务器,
curl --location --request POST 'https://localhost:9443/scim2/Bulk' \
--header 'Content-Type: application/scim+json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data-raw '{
emphasized text"failOnErrors":1,
"schemas": ["urn:ietf:params:scim:api:messages:2.0:BulkRequest"],
"Operations": [
{
"method": "POST",
"path": "/Users",
"bulkId": "bulkId01",
"data": {
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"userName": "Test",
"password":"Mohsen123",
"name": {
"givenName": "Test01",
"familyName": "Tes01t"
},
"emails": [
{
"type": "home",
"value": "home@test.com",
"primary": true
},
{
"type": "work",
"value": "work@test.com"
},
{
"type": "other",
"value": "other@test.com"
}
]
}
},
{
"method": "POST",
"path": "/Users",
"bulkId": "bulkId02",
"data": {
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
],
"name": {
"givenName": "Test02",
"familyName": "Test02"
},
"userName": "Test02",
"password": "Mohsen123",
"emails": [
{
"type": "home",
"value": "home@test.com",
"primary": true
},
{
"type": "work",
"value": "work@test.com"
},
{
"type": "other",
"value": "other@test.com"
}
],
"phoneNumbers":[
{
"value":"8811",
"type":"work"
},
{
"value":"3473344555",
"type":"mobile"
}
],
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"employeeNumber": "1234A",
"costCenter": "hello",
"country": "country",
"dob":"dateOfBirth",
"manager": {
"value": "Admin"
}
}
}
}
]
}
我在 mysql 上使用用户存储的 wso2 身份服务器版本 5.0.0。 当我尝试使用 phone 号码插入用户时,phone 号码未存储。
curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim@aaaa.it" ,"phoneNumbers":[{"value":"8811","type":"work"},{"value":"3473344555","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
结果是:
Connection #0 to host localhost left intact
{"id":"f6ce5310-a2ee-4976-9579-0299029183bb","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","phoneNumbers":[{"type":"work"},{"type":"mobile"}],"emails":"rossim@aaaa.it","meta":{"lastModified":"2015-08-19T16:09:50","location":"https://192.168.3.43:9443/wso2/scim/Users/f6ce5310-a2ee-4976-9579-0299029183bb","created":"2015-08-19T16:09:50"}}
如果我在 phone 数字中放入一个字符,它工作正常:
curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim@aaaa.it" ,"phoneNumbers":[{"value":"_8811","type":"work"},{"value":"_3473344555","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
结果是:
Connection #0 to host localhost left intact
{"id":"3ce83aca-6f70-4274-a2c3-5429132d6001","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","phoneNumbers":[{"value":"_8811","type":"work"},{"value":"_3473344555","type":"mobile"}],"emails":"rossim@aaaa.it","meta":{"lastModified":"2015-08-19T16:12:50","location":"https://192.168.3.43:9443/wso2/scim/Users/3ce83aca-6f70-4274-a2c3-5429132d6001","created":"2015-08-19T16:12:50"}}
为什么?一个 phone 数字...是一个数字!
Phone 在反斜杠内输入数字可以存储数字。示例:\"3473344555\"
请找到可以正常工作的修改后的 curl 命令。 curl -v -k --user admin:admin --data "{"schemas":[],"name":{"familyName":"Rossi","givenName":"Mario"},"userName":"rossiusr","password":"rossipsw","emails":"rossim@aaaa.it","phoneNumbers" :[{"value":\"8811\","type":"work"},{"value":\"3473344555\","type":"mobile"}]}" --header "Content-Type:application/json" https://localhost:9443/wso2/scim/Users
结果: {"id":"a5520dfc-aa7c-4b4b-aba2-57df7b87e2e4","schemas":["urn:scim:schemas:core:1.0"],"name":{"familyName":"Rossi","givenName":"Mario"},"userName": "rossiusr","phoneNumbers":[{"value":"8811","type":"work"},{"value":"3473344555","type":"mobile"}],"emails":"rossim@aaaa.it","meta":{"lastModified" :"2016-01-19T11:04:32","location":"https://localhost:9443/wso2/scim/Users/a5520dfc-aa7c-4b4b-aba2-57df7b87e2e4","created":"2016-01-19T11:04:32"}}* 到主机 localhost 的连接 #0 完好无损
这是一个 CURL POST 请求示例要将批量用户添加到 WSO2 身份服务器,
curl --location --request POST 'https://localhost:9443/scim2/Bulk' \
--header 'Content-Type: application/scim+json' \
--header 'Authorization: Basic YWRtaW46YWRtaW4=' \
--data-raw '{
emphasized text"failOnErrors":1,
"schemas": ["urn:ietf:params:scim:api:messages:2.0:BulkRequest"],
"Operations": [
{
"method": "POST",
"path": "/Users",
"bulkId": "bulkId01",
"data": {
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"userName": "Test",
"password":"Mohsen123",
"name": {
"givenName": "Test01",
"familyName": "Tes01t"
},
"emails": [
{
"type": "home",
"value": "home@test.com",
"primary": true
},
{
"type": "work",
"value": "work@test.com"
},
{
"type": "other",
"value": "other@test.com"
}
]
}
},
{
"method": "POST",
"path": "/Users",
"bulkId": "bulkId02",
"data": {
"schemas": [
"urn:ietf:params:scim:schemas:core:2.0:User",
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"
],
"name": {
"givenName": "Test02",
"familyName": "Test02"
},
"userName": "Test02",
"password": "Mohsen123",
"emails": [
{
"type": "home",
"value": "home@test.com",
"primary": true
},
{
"type": "work",
"value": "work@test.com"
},
{
"type": "other",
"value": "other@test.com"
}
],
"phoneNumbers":[
{
"value":"8811",
"type":"work"
},
{
"value":"3473344555",
"type":"mobile"
}
],
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"employeeNumber": "1234A",
"costCenter": "hello",
"country": "country",
"dob":"dateOfBirth",
"manager": {
"value": "Admin"
}
}
}
}
]
}