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
743 stars 723 forks source link

Improve identity-providers API to return template ID and count of each connection type #15715

Open Santhusha-Mallawatantri opened 1 year ago

Santhusha-Mallawatantri commented 1 year ago

Is your suggestion related to an experience ? Please describe. The current identity-providers API does not return the template id that is needed to identify multiple instances that is within a single IdP connection type.

The current implementation consists of a defaultAuthenticatorId that is not consistent in uniquely identifying each IdP connection type since some consist of the same defaultAuthenticatorId in cases like the Microsoft, Etheruem and Standard-based OIDC Idp connections

Describe the improvement The improvement of the identity-providers API should bring the following,

Additional context

sumedhe commented 1 year ago

1. Returning the template id along with the connection instance. Currently we have already implemented to store the created template id (connection type) along with the connection instance. But the templateId should not be empty to return it with the response. If we have created the instance with templateId field, it will be available in the response. image

2. Getting the count of the instances for each connection type (template). Currently there's no API endpoint available to get the count of the instances for a particular connection type. To get this we can follow one these approaches.

  1. Getting all the IDPs in one request and count the instances for each connection type in the frontend. For this we have to include the templateId to the connection listing responses. Currently it returns only the basic info like id, name, description, image etc. image
  2. Adding a support to filter with templateId for the connection listing endpoint [1]. Then we can call the connection listing endpoint, filtering with the templateID (connection type), and get the count. But for each connection type, we need do the call separately to get the counts.
  3. Using the extension mgt endpoint [2] to get the count for each template id. I don't recommend this as the extension mgt endpoint uses generalized approach to keep both idp and application templates and metadata. But the counting mechanism is differs for each extension type (connection, application, etc).

As we are going to use these counts for the connection listing page, I can suggest the Approach 1, because we can get the details in one call, and we can show the connection types tiles with the instance counts as well as the names of the instances.

[1] https://github.com/wso2/carbon-identity-framework/blob/43d5451f451257506963c8d482ad827b7e71a825/components/idp-mgt/org.wso2.carbon.idp.mgt/src/main/java/org/wso2/carbon/idp/mgt/dao/IdPManagementDAO.java#L756-L776 [2] https://github.com/wso2-enterprise/iam-engineering/issues/365

sumedhe commented 1 year ago

Checked the response coming from the identity-providers endpoint in Asgardeo. We are getting the templateId along with the identity provider information. But it is not coming with the listing endpoint. In order to get that from the listing endpoint, we have to introduce the templateId field to the IdentityProviderListItem model [1].

image

[1] https://github.com/wso2/identity-api-server/blob/1c31ddf02987c83b70257edbafedf6a57074ba01/components/org.wso2.carbon.identity.api.server.idp/org.wso2.carbon.identity.api.server.idp.v1/src/gen/java/org/wso2/carbon/identity/api/server/idp/v1/model/IdentityProviderListItem.java#L36