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
746 stars 725 forks source link

When same claim dialect addition request is sent twice, internal server error is returned #6744

Open madurangasiriwardena opened 4 years ago

madurangasiriwardena commented 4 years ago

Sample request

curl -X POST \
  https://localhost:9443/t/carbon.super/api/server/v1/claim-dialects \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 44' \
  -H 'Content-Type: application/json' \
  -H 'Cookie: requestedURI=../../api/server/v1/identity-governance/UGFzc3dvcmQgUG9saWNpZXM; JSESSIONID=A0AE8C744B8226F17B1F8492CF76EDED' \
  -H 'Host: localhost:9443' \
  -H 'cache-control: no-cache' \
  -d '{
  "dialectURI": "http://dummy.org/claim"
}'

Response for the 2nd request

{
    "code": "CMT-50001",
    "message": "Unable to add claim dialect.",
    "description": "Server encountered an error while adding the claim dialect http://dummy.org/claim.",
    "traceId": "6ae0accc-7233-41c0-bbe3-5dfd9c769252"
}
madurangasiriwardena commented 4 years ago

The same behavior is observed for the below request as well.

curl -X POST \
  https://localhost:9443/t/carbon.super/api/server/v1/claim-dialects/local/claims \
  -H 'Accept: */*' \
  -H 'Accept-Encoding: gzip, deflate' \
  -H 'Authorization: Basic YWRtaW46YWRtaW4=' \
  -H 'Cache-Control: no-cache' \
  -H 'Connection: keep-alive' \
  -H 'Content-Length: 446' \
  -H 'Content-Type: application/json' \
  -H 'Cookie: requestedURI=../../api/server/v1/identity-governance/UGFzc3dvcmQgUG9saWNpZXM; JSESSIONID=A0AE8C744B8226F17B1F8492CF76EDED' \
  -H 'Host: localhost:9443' \
  -H 'cache-control: no-cache' \
  -d '{
  "claimURI": "http://wso2.org/claims/dummyemailaddress",
  "description": "Dummy Email Address",
  "displayOrder": 6,
  "displayName": "Dummy Email",
  "readOnly": false,
  "regEx": "^\\S+@\\S+$",
  "required": true,
  "supportedByDefault": true,
  "attributeMapping": [
    {
      "mappedAttribute": "dummymail",
      "userstore": "PRIMARY"
    }
  ],
  "properties": [
    {
      "key": "isVerifiable",
      "value": "true"
    }
  ]
}
'