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 724 forks source link

[IMPROVEMENT] Remove resident application(SP) from application listing in REST API #8204

Open inthirakumaaran opened 4 years ago

inthirakumaaran commented 4 years ago

Describe the improvement It would be better if we can stop listing the resident application in the endpoint api/server/v1/applications. Currently, it is handled in the front end but it is better to handle that at API level

mefarazath commented 4 years ago

We have a check to skip the resident sp in the list response. But this doesn't seem to work due to work in the comparison logic[1].

In addition to this, we need to skip the resident SP when sending the count of applications matching a filter too[2].

It would be best to omit this from the query itself rather than trying to do it at the Java API. If we fix it at the Java API level it might lead to unexpected results.

For example, let's say there are 10 apps (with the resident SP). If we retrieve the results 5 items per page. We might end up with a page that has 5 and another with 4. Depending on the app id of resident SP we might first get a page with 4 and then a page with 5.

[1] https://github.com/wso2/carbon-identity-framework/blob/fb7c283f0f20302a6635fc6a26eb4eaeb8f084d0/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java#L3233-L3235

[2] https://github.com/wso2/carbon-identity-framework/blob/fb7c283f0f20302a6635fc6a26eb4eaeb8f084d0/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/dao/impl/ApplicationDAOImpl.java#L3172