From c0a09a828a69e0c8aefe045c8248809fa9ff7e9f Mon Sep 17 00:00:00 2001 From: JeethJJ Date: Mon, 14 Oct 2024 17:43:05 +0530 Subject: [PATCH 1/5] Introduce excludeSystemPortals query param. --- .../application/management/v1/ApplicationsApi.java | 7 ++++--- .../management/v1/ApplicationsApiService.java | 4 +++- .../v1/core/ServerApplicationManagementService.java | 11 +++++++++-- .../v1/impl/ApplicationsApiServiceImpl.java | 12 ++++++++++-- .../src/main/resources/applications.yaml | 11 +++++++++++ 5 files changed, 37 insertions(+), 8 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApi.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApi.java index f0cd6db86e..3b649d3b8b 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApi.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com). + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -481,9 +481,10 @@ public Response getAllApplicationTemplates( @Valid@ApiParam(value = "Maximum @ApiResponse(code = 500, message = "Server Error", response = Error.class), @ApiResponse(code = 501, message = "Not Implemented", response = Error.class) }) - public Response getAllApplications( @Valid @Min(1)@ApiParam(value = "Maximum number of records to return. ", defaultValue="30") @DefaultValue("30") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "Number of records to skip for pagination. ", defaultValue="0") @DefaultValue("0") @QueryParam("offset") Integer offset, @Valid@ApiParam(value = "Condition to filter the retrieval of records. Supports 'sw', 'co', 'ew', and 'eq' operations with 'and', 'or' logical operators. Please note that 'and' and 'or' operators in filters follow the general precedence of logical operators ex: A and B or C and D = (A and B) or (C and D)). Currently supports only filtering based on the 'name', the 'clientId', and the 'issuer' attributes. /applications?filter=name+eq+user_portal
/applications?filter=name+co+prod+or+clientId+co+123 ") @QueryParam("filter") String filter, @Valid@ApiParam(value = "Define the order in which the retrieved records should be sorted. _This parameter is not supported yet._ ", allowableValues="ASC, DESC") @QueryParam("sortOrder") String sortOrder, @Valid@ApiParam(value = "Attribute by which the retrieved records should be sorted. _This parameter is not supported yet._ ") @QueryParam("sortBy") String sortBy, @Valid@ApiParam(value = "Specifies the required parameters in the response. Currently supports for only 'advancedConfigurations', 'templateId', 'templateVersion', 'clientId', 'issuer', 'applicationEnabled' and 'associatedRoles.allowedAudience' attributes. /applications?attributes=advancedConfigurations,templateId,templateVersion,clientId,applicationEnabled,associatedRoles.allowedAudience ") @QueryParam("attributes") String attributes) { + public Response getAllApplications( @Valid @Min(1)@ApiParam(value = "Maximum number of records to return. ", defaultValue="30") @DefaultValue("30") @QueryParam("limit") Integer limit, @Valid@ApiParam(value = "Number of records to skip for pagination. ", defaultValue="0") @DefaultValue("0") @QueryParam("offset") Integer offset, @Valid@ApiParam(value = "Condition to filter the retrieval of records. Supports 'sw', 'co', 'ew', and 'eq' operations with 'and', 'or' logical operators. Please note that 'and' and 'or' operators in filters follow the general precedence of logical operators ex: A and B or C and D = (A and B) or (C and D)). Currently supports only filtering based on the 'name', the 'clientId', and the 'issuer' attributes. /applications?filter=name+eq+user_portal
/applications?filter=name+co+prod+or+clientId+co+123 ") @QueryParam("filter") String filter, @Valid@ApiParam(value = "Define the order in which the retrieved records should be sorted. _This parameter is not supported yet._ ", allowableValues="ASC, DESC") @QueryParam("sortOrder") String sortOrder, @Valid@ApiParam(value = "Attribute by which the retrieved records should be sorted. _This parameter is not supported yet._ ") @QueryParam("sortBy") String sortBy, @Valid@ApiParam(value = "Specifies the required parameters in the response. Currently supports for only 'advancedConfigurations', 'templateId', 'templateVersion', 'clientId', 'issuer', 'applicationEnabled' and 'associatedRoles.allowedAudience' attributes. /applications?attributes=advancedConfigurations,templateId,templateVersion,clientId,applicationEnabled,associatedRoles.allowedAudience ") @QueryParam("attributes") String attributes, @Valid@ApiParam(value = "Specifies whether to include or exclude system portals in the response. /applications?excludeSystemPortals=true ") @QueryParam("excludeSystemPortals") Boolean excludeSystemPortals) { - return delegate.getAllApplications(limit, offset, filter, sortOrder, sortBy, attributes ); + return delegate.getAllApplications(limit, offset, filter, sortOrder, sortBy, attributes, + excludeSystemPortals); } @Valid diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApiService.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApiService.java index c90527e09b..42f25d323c 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApiService.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApiService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, WSO2 LLC. (http://www.wso2.com). + * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -90,6 +90,8 @@ public interface ApplicationsApiService { public Response getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy, String attributes); + public Response getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy, String attributes, Boolean excludeSystemPortals); + public Response getApplication(String applicationId); public Response getApplicationTemplate(String templateId); diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java index 98b26b3272..f1bf49785a 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java @@ -254,6 +254,13 @@ public class ServerApplicationManagementService { public ApplicationListResponse getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy, String requiredAttributes) { + return getAllApplications(limit, offset, filter, sortOrder, sortBy, requiredAttributes, false); + } + + public ApplicationListResponse getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, + String sortBy, String requiredAttributes, + Boolean excludeSystemPortals) { + handleNotImplementedCapabilities(sortOrder, sortBy); String tenantDomain = ContextLoader.getTenantDomainFromContext(); @@ -277,10 +284,10 @@ public ApplicationListResponse getAllApplications(Integer limit, Integer offset, String username = ContextLoader.getUsernameFromContext(); try { int totalResults = getApplicationManagementService() - .getCountOfApplications(tenantDomain, username, filter); + .getCountOfApplications(tenantDomain, username, filter, excludeSystemPortals); ApplicationBasicInfo[] filteredAppList = getApplicationManagementService() - .getApplicationBasicInfo(tenantDomain, username, filter, offset, limit); + .getApplicationBasicInfo(tenantDomain, username, filter, offset, limit, excludeSystemPortals); int resultsInCurrentPage = filteredAppList.length; List requestedAttributeList = new ArrayList<>(); diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java index d6fef0ca9b..ebe65f731b 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java @@ -67,12 +67,20 @@ public class ApplicationsApiServiceImpl implements ApplicationsApiService { @Autowired private ServerApplicationSharingService applicationSharingService; + @Deprecated @Override public Response getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy, String requiredAttributes) { - ApplicationListResponse listResponse = applicationManagementService - .getAllApplications(limit, offset, filter, sortOrder, sortBy, requiredAttributes); + return getAllApplications(limit, offset, filter, sortOrder, sortBy, requiredAttributes, true); + } + + @Override + public Response getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy, + String requiredAttributes, Boolean excludeSystemPortals) { + + ApplicationListResponse listResponse = applicationManagementService.getAllApplications(limit, offset, filter, + sortOrder, sortBy, requiredAttributes, Boolean.parseBoolean(excludeSystemPortals.toString())); return Response.ok().entity(listResponse).build(); } diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml index 1667b034c3..33ec8c982c 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml @@ -38,6 +38,7 @@ paths: - $ref: '#/components/parameters/sortOrderQueryParam' - $ref: '#/components/parameters/sortByQueryParam' - $ref: '#/components/parameters/attributesQueryParam' + - $ref: '#/components/parameters/excludeSystemPortalsQueryParam' responses: '200': description: OK @@ -2701,6 +2702,16 @@ components: /applications?attributes=advancedConfigurations,templateId,templateVersion,clientId,applicationEnabled,associatedRoles.allowedAudience schema: type: string + excludeSystemPortalsQueryParam: + in: query + name: excludeSystemPortals + required: false + description: | + Specifies whether to include or exclude system portals in the response. + + /applications?excludeSystemPortals=true + schema: + type: boolean exportSecretsQueryParam: in: query name: exportSecrets From 68a5bdcc3ca3503266c81268437d963e6870219f Mon Sep 17 00:00:00 2001 From: JeethJJ Date: Mon, 14 Oct 2024 17:46:59 +0530 Subject: [PATCH 2/5] Remove license change. --- .../api/server/application/management/v1/ApplicationsApi.java | 2 +- .../management/v1/core/ServerApplicationManagementService.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApi.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApi.java index 3b649d3b8b..01a43fc798 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApi.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/gen/java/org/wso2/carbon/identity/api/server/application/management/v1/ApplicationsApi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, WSO2 LLC. (http://www.wso2.com). + * Copyright (c) 2023-2024, WSO2 LLC. (http://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java index f1bf49785a..08404d7944 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/core/ServerApplicationManagementService.java @@ -251,6 +251,7 @@ public class ServerApplicationManagementService { @Autowired private ServerApplicationMetadataService applicationMetadataService; + @Deprecated public ApplicationListResponse getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy, String requiredAttributes) { From 8aeaa39a20778bfd402e8f5e9251b3a8ee54a7e0 Mon Sep 17 00:00:00 2001 From: JeethJJ Date: Tue, 15 Oct 2024 11:05:03 +0530 Subject: [PATCH 3/5] Resolve null check. --- .../management/v1/impl/ApplicationsApiServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java index ebe65f731b..49055dc08b 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java @@ -80,7 +80,7 @@ public Response getAllApplications(Integer limit, Integer offset, String filter, String requiredAttributes, Boolean excludeSystemPortals) { ApplicationListResponse listResponse = applicationManagementService.getAllApplications(limit, offset, filter, - sortOrder, sortBy, requiredAttributes, Boolean.parseBoolean(excludeSystemPortals.toString())); + sortOrder, sortBy, requiredAttributes, Boolean.parseBoolean(String.valueOf(excludeSystemPortals))); return Response.ok().entity(listResponse).build(); } From 0e01f11829d4f0c5baf9cffd6a422a5e8bdb2150 Mon Sep 17 00:00:00 2001 From: JeethJJ Date: Wed, 16 Oct 2024 19:40:41 +0530 Subject: [PATCH 4/5] Address comments. --- .../management/v1/impl/ApplicationsApiServiceImpl.java | 2 +- .../src/main/resources/applications.yaml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java index 49055dc08b..abf999d4c3 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java @@ -80,7 +80,7 @@ public Response getAllApplications(Integer limit, Integer offset, String filter, String requiredAttributes, Boolean excludeSystemPortals) { ApplicationListResponse listResponse = applicationManagementService.getAllApplications(limit, offset, filter, - sortOrder, sortBy, requiredAttributes, Boolean.parseBoolean(String.valueOf(excludeSystemPortals))); + sortOrder, sortBy, requiredAttributes, Boolean.TRUE.equals(excludeSystemPortals)); return Response.ok().entity(listResponse).build(); } diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml index 991408f582..0fa41a8d2b 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/resources/applications.yaml @@ -2707,7 +2707,8 @@ components: name: excludeSystemPortals required: false description: | - Specifies whether to include or exclude system portals in the response. + Specifies whether to include or exclude system portals in the response. + Default will be treated as false if parameter is not preset in the request. /applications?excludeSystemPortals=true schema: From 1db3e049a17d85a6974525c93f50d27520ddb979 Mon Sep 17 00:00:00 2001 From: JeethJJ Date: Thu, 17 Oct 2024 19:56:10 +0530 Subject: [PATCH 5/5] Address comments and bump framework version. --- .../management/v1/impl/ApplicationsApiServiceImpl.java | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java index abf999d4c3..3b23d55554 100644 --- a/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java +++ b/components/org.wso2.carbon.identity.api.server.application.management/org.wso2.carbon.identity.api.server.application.management.v1/src/main/java/org/wso2/carbon/identity/api/server/application/management/v1/impl/ApplicationsApiServiceImpl.java @@ -72,7 +72,7 @@ public class ApplicationsApiServiceImpl implements ApplicationsApiService { public Response getAllApplications(Integer limit, Integer offset, String filter, String sortOrder, String sortBy, String requiredAttributes) { - return getAllApplications(limit, offset, filter, sortOrder, sortBy, requiredAttributes, true); + return getAllApplications(limit, offset, filter, sortOrder, sortBy, requiredAttributes, false); } @Override diff --git a/pom.xml b/pom.xml index f899586dda..1aa47bcf76 100644 --- a/pom.xml +++ b/pom.xml @@ -803,7 +803,7 @@ 1.4 1.2.4 1.10.6 - 7.5.46 + 7.5.69 3.0.5 1.12.0 **/gen/**/*