Skip to content

Commit

Permalink
Merge branch 'wso2:master' into add-oauth-attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinthakaJ98 authored Oct 19, 2023
2 parents 64f9ec8 + 9fbd079 commit 2b99407
Show file tree
Hide file tree
Showing 126 changed files with 3,903 additions and 105 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.expired.password.identification</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.expired.password.identification</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.idle.account.identification</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.idle.account.identification</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>org.wso2.carbon.identity.api.server.admin.advisory.management</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>org.wso2.carbon.identity.api.server.admin.advisory.management</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.api.resource</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.api.resource</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ public class APIResourceMgtEndpointConstants {
private APIResourceMgtEndpointConstants() {
}

public static final String API_RESOURCE_TYPE = "BUSINESS";
public static final String BUSINESS_API_RESOURCE_TYPE = "BUSINESS";
public static final String SYSTEM_API_RESOURCE_TYPE = "SYSTEM";
public static final String API_RESOURCE_MANAGEMENT_PREFIX = "API-RESOURCE-";
public static final String API_RESOURCE_PATH_COMPONENT = "/api-resources";
private static final List<String> allowedAttributeList = new ArrayList<>();
Expand Down Expand Up @@ -79,6 +80,8 @@ public enum ErrorMessage {
"Limit should be a positive integer."),
ERROR_CODE_BOTH_BEFORE_AFTER_PROVIDED("60011", "Invalid before/after provided.",
"Both before and after parameters cannot be provided at the same time."),
ERROR_CODE_SYSTEM_API_RESOURCE_NOT_MODIFIABLE("60012", "Cannot modify or delete System APIs.",
"Cannot modify or delete the read-only System APIs."),

// Server errors.
ERROR_CODE_ADD_API_RESOURCE("65001", "Error while adding api resource.", "Server encountered an error while " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void patchAPIResourceById(String apiResourceID, APIResourcePatchModel api

try {
APIResource currentAPIResource = getAPIResourceById(apiResourceID);

handleSystemAPI(currentAPIResource);
if (apiResourcePatchModel.getRemovedScopes() != null) {
LOG.debug("Removed scopes field is not supported in patch operation.");
throw APIResourceMgtEndpointUtil.handleException(Response.Status.NOT_IMPLEMENTED,
Expand Down Expand Up @@ -244,8 +244,15 @@ public void deleteAPIResource(String apiResourceID) {
if (LOG.isDebugEnabled()) {
LOG.debug("Deleting API Resource with ID: " + apiResourceID);
}
String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();
APIResource apiResource = APIResourceManagementServiceHolder.getApiResourceManager()
.getAPIResourceById(apiResourceID, tenantDomain);
if (apiResource == null) {
return;
}
handleSystemAPI(apiResource);
APIResourceManagementServiceHolder.getApiResourceManager().deleteAPIResourceById(apiResourceID,
CarbonContext.getThreadLocalCarbonContext().getTenantDomain());
tenantDomain);
} catch (APIResourceMgtException e) {
throw APIResourceMgtEndpointUtil.handleAPIResourceMgtException(e);
}
Expand Down Expand Up @@ -287,6 +294,7 @@ public void putScopesByAPIId(String apiResourceId, List<ScopeCreationModel> scop
throw APIResourceMgtEndpointUtil.handleException(Response.Status.NOT_FOUND,
APIResourceMgtEndpointConstants.ErrorMessage.ERROR_CODE_API_RESOURCE_NOT_FOUND, apiResourceId);
}
handleSystemAPI(apiResource);
List<Scope> scopes = createScopes(scopeCreationModels);
APIResourceManagementServiceHolder.getApiResourceManager().putScopes(apiResourceId, apiResource.getScopes(),
scopes, CarbonContext.getThreadLocalCarbonContext().getTenantDomain());
Expand All @@ -307,9 +315,15 @@ public void deleteScopeByScopeName(String apiResourceId, String scopeName) {
if (LOG.isDebugEnabled()) {
LOG.debug("Deleting scope with ID: " + scopeName + " of API Resource ID: " + apiResourceId);
}
APIResourceManagementServiceHolder.getApiResourceManager()
.deleteAPIScopeByScopeName(apiResourceId, scopeName,
CarbonContext.getThreadLocalCarbonContext().getTenantDomain());
String tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain();
APIResource apiResource = APIResourceManagementServiceHolder.getApiResourceManager()
.getAPIResourceById(apiResourceId, tenantDomain);
if (apiResource == null) {
return;
}
handleSystemAPI(apiResource);
APIResourceManagementServiceHolder.getApiResourceManager().deleteAPIScopeByScopeName(apiResourceId,
scopeName, tenantDomain);
} catch (APIResourceMgtException e) {
throw APIResourceMgtEndpointUtil.handleAPIResourceMgtException(e);
}
Expand Down Expand Up @@ -381,7 +395,7 @@ private APIResource createAPIResource(APIResourceCreationModel apIResourceCreati
.scopes(createScopes(apIResourceCreationModel.getScopes()))
.requiresAuthorization(apIResourceCreationModel.getRequiresAuthorization() != null ?
apIResourceCreationModel.getRequiresAuthorization() : true)
.type(APIResourceMgtEndpointConstants.API_RESOURCE_TYPE);
.type(APIResourceMgtEndpointConstants.BUSINESS_API_RESOURCE_TYPE);
return apiResourceBuilder.build();
}

Expand Down Expand Up @@ -459,4 +473,17 @@ private static Integer validatedLimit(Integer limit) throws APIError {
}
return limit;
}

/**
* Validate whether the given API resource is a system API resource and throw an error if it is.
*
* @param apiResource API resource to be handled.
*/
private void handleSystemAPI(APIResource apiResource) {

if (APIResourceMgtEndpointConstants.SYSTEM_API_RESOURCE_TYPE.equals(apiResource.getType())) {
throw APIResourceMgtEndpointUtil.handleException(Response.Status.FORBIDDEN,
ErrorMessage.ERROR_CODE_SYSTEM_API_RESOURCE_NOT_MODIFIABLE);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.application.management</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.application.management.common</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.application.management</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<name>WSO2 Identity Server - Applications Rest API</name>
<description>WSO2 Identity Server - Applications Rest API</description>
<artifactId>org.wso2.carbon.identity.api.server.application.management.v1</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<packaging>jar</packaging>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.application.management</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.authenticators</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.authenticators.common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.authenticators</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.authenticators.v1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.branding.preference.management</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>

<groupId>org.wso2.carbon.identity.server.api</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<artifactId>org.wso2.carbon.identity.api.server.branding.preference.management</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<relativePath>../pom.xml</relativePath>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<artifactId>org.wso2.carbon.identity.api.server.challenge</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<relativePath>../pom.xml</relativePath>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.api.server.challenge.common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.challenge</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.rest.api.server.challenge.v1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<artifactId>org.wso2.carbon.identity.api.server.claim.management</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<relativePath>../pom.xml</relativePath>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.api.server.claim.management.common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.claim.management</artifactId>
<relativePath>../pom.xml</relativePath>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.rest.api.server.claim.management.v1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.configs</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.configs.common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.configs</artifactId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.configs.v1</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.2.94-SNAPSHOT</version>
<version>1.2.96-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Loading

0 comments on commit 2b99407

Please sign in to comment.