Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
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.idle.account.identification</artifactId>
<version>1.3.153</version>
<version>1.3.156-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.idle.account.identification</artifactId>
<version>1.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>org.wso2.carbon.identity.api.server.action.management</artifactId>
<version>1.3.153</version>
<version>1.3.156-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.action.management</artifactId>
<version>1.3.153</version>
<version>1.3.156-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -53,6 +53,11 @@
<artifactId>org.wso2.carbon.identity.user.pre.update.profile.action</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.organization.management.core</groupId>
<artifactId>org.wso2.carbon.identity.organization.management.service</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public enum ErrorMessage {
ERROR_INVALID_RULE("60013", "Invalid rule.", "%s"),
ERROR_INVALID_PAYLOAD("60014", "Invalid Request body.",
"Provided request body content is not in the expected format."),
ERROR_NOT_ALLOWED_ACTION_TYPE_IN_ORG_LEVEL("60015", "Action type is not allowed.",
"The requested action type: %s is not allowed at the organization level."),

// Server errors.
ERROR_NOT_IMPLEMENTED_ACTION_TYPE("650015",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.identity.action.management.api.exception.ActionMgtException;
import org.wso2.carbon.identity.action.management.api.exception.ActionMgtServerException;
import org.wso2.carbon.identity.action.management.api.model.Action;
import org.wso2.carbon.identity.action.management.api.service.ActionManagementService;
import org.wso2.carbon.identity.api.server.action.management.v1.ActionBasicResponse;
Expand All @@ -34,6 +35,8 @@
import org.wso2.carbon.identity.api.server.action.management.v1.mapper.ActionMapperFactory;
import org.wso2.carbon.identity.api.server.action.management.v1.util.ActionDeserializer;
import org.wso2.carbon.identity.api.server.action.management.v1.util.ActionMgtEndpointUtil;
import org.wso2.carbon.identity.organization.management.service.exception.OrganizationManagementException;
import org.wso2.carbon.identity.organization.management.service.util.OrganizationManagementUtil;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -45,6 +48,7 @@
import javax.ws.rs.core.Response;

import static org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants.ErrorMessage.ERROR_INVALID_ACTION_TYPE;
import static org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants.ErrorMessage.ERROR_NOT_ALLOWED_ACTION_TYPE_IN_ORG_LEVEL;
import static org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants.ErrorMessage.ERROR_NOT_IMPLEMENTED_ACTION_TYPE;
import static org.wso2.carbon.identity.api.server.action.management.v1.constants.ActionMgtEndpointConstants.ErrorMessage.ERROR_NO_ACTION_FOUND_ON_GIVEN_ACTION_TYPE_AND_ID;

Expand All @@ -56,6 +60,7 @@ public class ServerActionManagementService {
private final ActionManagementService actionManagementService;
private static final Log LOG = LogFactory.getLog(ServerActionManagementService.class);
private static final Set<String> NOT_IMPLEMENTED_ACTION_TYPES = new HashSet<>();
private static final Set<String> NOT_ALLOWED_ACTION_TYPES_IN_ORG_LEVEL = new HashSet<>();

public ServerActionManagementService(ActionManagementService actionManagementService) {

Expand All @@ -65,6 +70,8 @@ public ServerActionManagementService(ActionManagementService actionManagementSer
static {
NOT_IMPLEMENTED_ACTION_TYPES.add(Action.ActionTypes.PRE_REGISTRATION.getPathParam());
NOT_IMPLEMENTED_ACTION_TYPES.add(Action.ActionTypes.AUTHENTICATION.getPathParam());

NOT_ALLOWED_ACTION_TYPES_IN_ORG_LEVEL.add(Action.ActionTypes.PRE_ISSUE_ACCESS_TOKEN.getPathParam());
}

public ActionResponse createAction(String actionType, String jsonBody) {
Expand Down Expand Up @@ -170,15 +177,17 @@ public List<ActionTypesResponseItem> getActionTypes() {
List<ActionTypesResponseItem> actionTypesResponseItems = new ArrayList<>();
for (Action.ActionTypes actionType : Action.ActionTypes.filterByCategory(
Action.ActionTypes.Category.PRE_POST)) {

if (!NOT_IMPLEMENTED_ACTION_TYPES.contains(actionType.getPathParam())) {
actionTypesResponseItems.add(new ActionTypesResponseItem()
.type(ActionType.valueOf(actionType.getActionType()))
.displayName(actionType.getDisplayName())
.description(actionType.getDescription())
.count(actionsCountPerType.getOrDefault(actionType.getActionType(), 0))
.self(ActionMgtEndpointUtil.buildURIForActionType(actionType.getActionType())));
if (NOT_IMPLEMENTED_ACTION_TYPES.contains(actionType.getPathParam()) || (isOrganization() &&
NOT_ALLOWED_ACTION_TYPES_IN_ORG_LEVEL.contains(actionType.getPathParam()))) {
continue;
}

actionTypesResponseItems.add(new ActionTypesResponseItem()
.type(ActionType.valueOf(actionType.getActionType()))
.displayName(actionType.getDisplayName())
.description(actionType.getDescription())
.count(actionsCountPerType.getOrDefault(actionType.getActionType(), 0))
.self(ActionMgtEndpointUtil.buildURIForActionType(actionType.getActionType())));
}

return actionTypesResponseItems;
Expand Down Expand Up @@ -245,14 +254,18 @@ private Action buildUpdatingAction(Action.ActionTypes actionType, String jsonBod
return actionMapper.toAction(actionUpdateModel);
}

private Action.ActionTypes validateActionType(String actionType) {
private Action.ActionTypes validateActionType(String actionType) throws ActionMgtException {

Action.ActionTypes actionTypeEnum = getActionTypeFromPath(actionType);

if (NOT_IMPLEMENTED_ACTION_TYPES.contains(actionTypeEnum.getPathParam())) {
throw ActionMgtEndpointUtil.handleException(Response.Status.NOT_IMPLEMENTED,
ERROR_NOT_IMPLEMENTED_ACTION_TYPE);
}
if (isOrganization() && NOT_ALLOWED_ACTION_TYPES_IN_ORG_LEVEL.contains(actionTypeEnum.getPathParam())) {
throw ActionMgtEndpointUtil.handleException(Response.Status.FORBIDDEN,
ERROR_NOT_ALLOWED_ACTION_TYPE_IN_ORG_LEVEL, actionTypeEnum.getActionType());
}

return actionTypeEnum;
}
Expand All @@ -265,4 +278,13 @@ private Action.ActionTypes getActionTypeFromPath(String actionType) {
.orElseThrow(() -> ActionMgtEndpointUtil.handleException(Response.Status.BAD_REQUEST,
ERROR_INVALID_ACTION_TYPE));
}

private boolean isOrganization() throws ActionMgtException {

try {
return OrganizationManagementUtil.isOrganization(CarbonContext.getThreadLocalCarbonContext().getTenantId());
} catch (OrganizationManagementException e) {
throw new ActionMgtServerException("Error while checking if the tenant is an organization.", e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<artifactId>identity-api-server</artifactId>
<version>1.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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>
<artifactId>identity-api-server</artifactId>
<groupId>org.wso2.carbon.identity.server.api</groupId>
<version>1.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.application.management.common</artifactId>
<version>1.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.application.management</artifactId>
<version>1.3.153</version>
<version>1.3.156-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.asynchronous.operation.status.management</artifactId>
<version>1.3.153</version>
<version>1.3.156-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.asynchronous.operation.status.management</artifactId>
<version>1.3.153</version>
<version>1.3.156-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>identity-api-server</artifactId>
<version>1.3.153</version>
<version>1.3.156-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.authenticators</artifactId>
<version>1.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.3.153</version>
<version>1.3.156-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.certificate.validation.management</artifactId>
<version>1.3.153</version>
<version>1.3.156-SNAPSHOT</version>
</parent>

<artifactId>org.wso2.carbon.identity.api.server.certificate.validation.management.common</artifactId>
Expand Down
Loading