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

Service Provider config requested claims are not getting updated correctly #10671

Open lakshithakasun opened 3 years ago

lakshithakasun commented 3 years ago

Environment: Identity Server 5.10.0 / 5.11.0

Steps to reproduce:

  1. Add a Service Provider
  2. Edit Service Provider > Claim Configuration > Requested Claims > Click Add Claim URI and add few claims (3-5 claims)
  3. Update
  4. Again Edit Service Provider > Claim configuration > Requested Claims > remove few claims (remove 2 claims out of 3)
  5. Without Clicking Update Add another new Claim (now total claims are 2)
  6. Click Update
  7. Now again list down the requested claims and check whether the newly added claim is there but notice that it has not been saved

Findings:

In the update method of the ApplicationBean[1], when updating the claims it takes the claims using request parameters and each claim gets a number appended in the request parameter depending on the number of rows in the UI table. As an example if there are 2 claims in the UI table those claims will be referred as idpClaim_0 and idpClaim_1 OR spClaim_0 and spClaim_1, check the logic in update method [1]

These row number values are set by using a logic in configure-service-provider.jsp [2] and it seems like the claimMappinRowID variable does not get updated correctly when trying to remove and add claims simultaneously

[1] - https://github.com/wso2/carbon-identity-framework/blob/7482f7e649fbfe93b513bd9e460faea8263a36b0/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/src/main/java/org/wso2/carbon/identity/application/mgt/ui/ApplicationBean.java#L1316

[2] - https://github.com/wso2/carbon-identity-framework/blob/7482f7e649fbfe93b513bd9e460faea8263a36b0/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/src/main/resources/web/application/configure-service-provider.jsp#L507

pulasthi7 commented 3 years ago

Deprioritizing due to coming from management console only (which will be deprecated in near future).