wso2 / product-is

Welcome to the WSO2 Identity Server source code! For info on working with the WSO2 Identity Server repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
748 stars 727 forks source link

Incorrect Resopnse code validation when trying to update a non existing user with PUT Request in Tenant mode #7450

Closed ShanikaWickramasinghe closed 5 days ago

ShanikaWickramasinghe commented 4 years ago

Environment IS 5.10.0 alpha3 snapshot DB Mysql 5.7

Steps to Reproduce

  1. In deployment.toml change the primary userstore to uniqueidjdbc userstore [user_store] type = "database_unique_id" [user_store.properties] SCIMEnabled= true

  2. Add a tenant as admin@wso2.com:admin

  3. Create a user in tenant mode

curl -v -k --user admin@wso2.com:admin --data '{"schemas":[],"name":{"familyName":"jackson","givenName":"kim"},"userName":"kim","password":"kimwso2","emails":[{"primary":true,"value":"kim.jackson@gmail.com","type":"home"},{"value":"kim_j@wso2.com","type":"work"}]}' --header "Content-Type:application/json" https://localhost:9443/t/wso2.com/scim2/Users -i

  1. Try to update the user with a PUT request by providing a non existing user Id

curl -v -k --user admin@wso2.com:admin -X PUT -d '{"schemas":[],"name":{"familyName":"jackson","givenName":"kimfiNaL123"},"userName":"kim","emails":[{"value":"kim_j@wso2.com","type":"work"},{"value":"kim.jack@gmail.com","type":"home"}]}' --header "Content-Type:application/json" https://localhost:9443/t/wso2.com/scim2/Users/b7e0e71b-3fef-4009-883f-8cbdc8459f40 -i

Response

{"schemas":["urn:ietf:params:scim:api:messages:2.0:Error"],"detail":"Error in getting user information from Carbon User Store foruser: b7e0e71b-3fef-4009-883f-8cbdc8459f40345","status":"500"}

Here the Response code validation needs to be handled as HTTP 404 (User does not exist) and currently it is giving 500

ShanikaWickramasinghe commented 4 years ago

Observing the same behaviour for PATCH update request for a non existing user as well

Request curl -v -k --user admin@wso2.com:admin -X PATCH -d '{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],"Operations":[{"op":"add","value":{"nickName":"shaggy"}}]}' --header "Content-Type:application/json" https://localhost:9443/t/wso2.com/scim2/Users/c8c821ba-1200-495e-a775-79b260e717bd89 -i

Response

{"schemas":["urn:ietf:params:scim:api:messages:2.0:Error"],"detail":"Error in getting user information from Carbon User Store foruser: c8c821ba-1200-495e-a775-79b260e717bd89","status":"500"}

isharak commented 5 days ago

This issue is being closed due to extended inactivity. Please feel free to reopen it if further attention is needed. Thank you for helping us keep the issue list relevant and focused!