Skip to content

Commit

Permalink
Merge branch 'wso2:master' into new-adapter-service
Browse files Browse the repository at this point in the history
  • Loading branch information
Thisara-Welmilla authored Jan 26, 2025
2 parents 98a9317 + 9ab6646 commit 86b4aae
Show file tree
Hide file tree
Showing 287 changed files with 4,765 additions and 872 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>action-mgt</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public static ActionExecutionResponseProcessor getActionExecutionResponseProcess
switch (actionType) {
case PRE_ISSUE_ACCESS_TOKEN:
return actionInvocationResponseProcessors.get(ActionType.PRE_ISSUE_ACCESS_TOKEN);
case PRE_UPDATE_PASSWORD:
return actionInvocationResponseProcessors.get(ActionType.PRE_UPDATE_PASSWORD);
case AUTHENTICATION:
return actionInvocationResponseProcessors.get(ActionType.AUTHENTICATION);
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ public ActionExecutionStatus<?> execute(ActionType actionType, Map<String, Objec
validateActions(actions, actionType);
// As of now only one action is allowed.
Action action = actions.get(0);
eventContext.put("action", action);
return execute(action, eventContext, tenantDomain);
} catch (ActionExecutionRuntimeException e) {
LOG.debug("Skip executing actions for action type: " + actionType.name(), e);
Expand Down Expand Up @@ -149,6 +150,7 @@ public ActionExecutionStatus<?> execute(ActionType actionType, String actionId,
}

Action action = getActionByActionId(actionType, actionId, tenantDomain);
eventContext.put("action", action);
try {
return execute(action, eventContext, tenantDomain);
} catch (ActionExecutionRuntimeException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*/
public enum ActionType {
PRE_ISSUE_ACCESS_TOKEN,
PRE_UPDATE_PASSWORD,
AUTHENTICATION;

public String getDisplayName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void testActionExecuteSuccessWhenNoActionsAvailableForActionType() throws
public void testActionExecuteSuccessWhenNoActiveActionAvailableForActionType() throws Exception {

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

Action action = mock(Action.class);
when(action.getStatus()).thenReturn(Action.Status.INACTIVE);
Expand Down Expand Up @@ -200,7 +200,7 @@ public void testActionExecuteSuccessWhenRuleConfiguredAndNotSatisfied() throws E
when(ruleEvaluationService.evaluate(any(), any(), any())).thenReturn(new RuleEvaluationResult("ruleId", false));

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

ActionExecutionStatus<?> status = actionExecutorService.execute(actionType, eventContext, "tenantDomain");

Expand Down Expand Up @@ -231,10 +231,10 @@ public void testActionExecuteWithActionIdsFailureWheNullActionId() throws Except
public void testActionExecuteFailureWhenNoRegisteredRequestBuilderForActionType() throws Exception {

Action action = createAction();
when(actionManagementService.getActionsByActionType(any(), any())).thenReturn(
when(actionManagementService.getActionsByActionType(any(), eq("tenantDomain"))).thenReturn(
Collections.singletonList(action));

actionExecutorService.execute(ActionType.PRE_ISSUE_ACCESS_TOKEN, any(), any());
actionExecutorService.execute(ActionType.PRE_ISSUE_ACCESS_TOKEN, new HashMap<>(), "tenantDomain");
}

@Test(expectedExceptions = ActionExecutionException.class,
Expand Down Expand Up @@ -272,7 +272,7 @@ public void testActionExecuteFailureWhenRuleEvaluationFails() throws Exception {
when(ruleEvaluationService.evaluate(any(), any(), any())).thenThrow(new RuleEvaluationException("Error"));

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

ActionExecutionStatus<?> status = actionExecutorService.execute(actionType, eventContext, "tenantDomain");

Expand All @@ -298,8 +298,7 @@ public void testActionExecuteFailureWhenBuildingActionExecutionRequestForActionI
when(actionExecutionRequestBuilder.buildActionExecutionRequest(any())).thenThrow(
new ActionExecutionRequestBuilderException("Error while executing request builder."));

actionExecutorService.execute(actionType, "actionId", Collections.emptyMap(),
"tenantDomain");
actionExecutorService.execute(actionType, "actionId", new HashMap<>(), "tenantDomain");
}

@Test(expectedExceptions = ActionExecutionException.class)
Expand All @@ -318,11 +317,11 @@ public void testActionExecuteFailureAtExceptionFromRequestBuilderForActionType()
when(actionManagementService.getActionByActionId(any(), any(), any())).thenReturn(action);

ActionExecutionStatus actionExecutionStatus =
actionExecutorService.execute(ActionType.PRE_ISSUE_ACCESS_TOKEN, any(), any());
actionExecutorService.execute(ActionType.PRE_ISSUE_ACCESS_TOKEN, new HashMap<>(), "tenantDomain");
assertEquals(actionExecutionStatus.getStatus(), ActionExecutionStatus.Status.FAILED);

ActionExecutionStatus actionExecutionStatusWithActionIds = actionExecutorService.execute(
ActionType.PRE_ISSUE_ACCESS_TOKEN, any(), any(), any());
ActionType.PRE_ISSUE_ACCESS_TOKEN, any(), new HashMap<>(), "tenantDomain");
assertEquals(actionExecutionStatusWithActionIds.getStatus(), ActionExecutionStatus.Status.FAILED);
}

Expand All @@ -342,7 +341,7 @@ public void testActionExecuteFailureWhenNoRegisteredResponseProcessorForActionTy
() -> ActionExecutionRequestBuilderFactory.getActionExecutionRequestBuilder(any()))
.thenReturn(actionExecutionRequestBuilder);

actionExecutorService.execute(ActionType.PRE_ISSUE_ACCESS_TOKEN, any(), any());
actionExecutorService.execute(ActionType.PRE_ISSUE_ACCESS_TOKEN, new HashMap<>(), "tenantDomain");
}

@Test(expectedExceptions = ActionExecutionException.class,
Expand All @@ -369,7 +368,7 @@ public void testBuildActionExecutionRequestWithExcludedHeaders()
throws Exception {

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

Action action = createAction();
when(actionManagementService.getActionsByActionType(any(), any())).thenReturn(
Expand Down Expand Up @@ -404,7 +403,7 @@ public void testBuildActionExecutionRequestWithExcludedHeaders()
public void testBuildActionExecutionRequest() throws Exception {

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

Action action = createAction();
when(actionManagementService.getActionsByActionType(any(), any())).thenReturn(
Expand Down Expand Up @@ -436,7 +435,7 @@ public void testBuildActionExecutionRequest() throws Exception {
public void testActionExecuteSuccessWhenNoRuleConfiguredInAction() throws Exception {

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

Action action = createAction();
when(actionManagementService.getActionsByActionType(any(), any())).thenReturn(
Expand Down Expand Up @@ -479,7 +478,7 @@ public void testActionExecuteSuccessWhenNoRuleConfiguredInAction() throws Except
public void testActionExecuteSuccessWhenRuleConfiguredInActionIsSatisfied() throws Exception {

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

Action action = createAction();
when(action.getActionRule()).thenReturn(ActionRule.create("ruleId", "tenantDomain"));
Expand Down Expand Up @@ -526,7 +525,7 @@ public void testActionExecuteSuccessWhenRuleConfiguredInActionIsSatisfied() thro
public void testActionExecuteFailure() throws Exception {

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

Action action = createAction();
when(actionManagementService.getActionsByActionType(any(), any())).thenReturn(
Expand Down Expand Up @@ -567,7 +566,7 @@ public void testActionExecuteFailure() throws Exception {
public void testExecuteIncomplete() throws Exception {

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

Action action = createAction();
when(actionManagementService.getActionsByActionType(any(), any())).thenReturn(
Expand Down Expand Up @@ -607,7 +606,7 @@ public void testExecuteIncomplete() throws Exception {
public void testActionExecuteFailureForUnexpectedAPIResponse() throws Exception {

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

Action action = createAction();
when(actionManagementService.getActionsByActionType(any(), any())).thenReturn(
Expand Down Expand Up @@ -635,7 +634,7 @@ public void testActionExecuteFailureForUnexpectedAPIResponse() throws Exception
public void testExecuteError() throws Exception {

ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN;
Map<String, Object> eventContext = Collections.emptyMap();
Map<String, Object> eventContext = new HashMap<>();

Action action = createAction();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>action-mgt</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/action-mgt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>identity-framework</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-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.framework</groupId>
<artifactId>ai-services-mgt</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion components/ai-services-mgt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>identity-framework</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-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.framework</groupId>
<artifactId>api-resource-mgt</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-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.framework</groupId>
<artifactId>api-resource-mgt</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>org.wso2.carbon.identity.api.resource.mgt</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion components/api-resource-mgt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>identity-framework</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>application-mgt</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-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.framework</groupId>
<artifactId>application-mgt</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-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.framework</groupId>
<artifactId>application-mgt</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>org.wso2.carbon.identity.application.mgt</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion components/application-mgt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>identity-framework</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-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.framework</groupId>
<artifactId>authentication-framework</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-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.framework</groupId>
<artifactId>authentication-framework</artifactId>
<version>7.7.141-SNAPSHOT</version>
<version>7.7.149-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.InternalRoleDomains.WORKFLOW_DOMAIN;
import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.PROVISIONED_SOURCE_ID_CLAIM;
import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.USERNAME_CLAIM;
import static org.wso2.carbon.identity.application.authentication.framework.util.FrameworkConstants.USER_ID_CLAIM;
import static org.wso2.carbon.identity.role.v2.mgt.core.RoleConstants.ORGANIZATION;

/**
Expand Down Expand Up @@ -275,6 +276,7 @@ private void handleUserProvisioning(String username, UserStoreManager userStoreM

userClaims.remove(FrameworkConstants.PASSWORD);
userClaims.remove(USERNAME_CLAIM);
userClaims.remove(USER_ID_CLAIM);
userStoreManager.setUserClaimValues(UserCoreUtil.removeDomainFromName(username), userClaims, null);
/*
Since the user is exist following code is get all active claims of user and crosschecking against
Expand Down
Loading

0 comments on commit 86b4aae

Please sign in to comment.