diff --git a/.github/workflows/pr-builder.yml b/.github/workflows/pr-builder.yml index 513da67532e6..af21e61d3670 100644 --- a/.github/workflows/pr-builder.yml +++ b/.github/workflows/pr-builder.yml @@ -40,3 +40,10 @@ jobs: run: mvn clean install -U -B - name: Delete SNAPSHOT artifacts run: find ~/.m2/repository/ -name "*-SNAPSHOT" -type d -print -prune -exec rm -r {} + + - name: Generate coverage report + run: mvn test jacoco:report + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: target/site/jacoco/jacoco.xml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 000000000000..25d8f200167b --- /dev/null +++ b/codecov.yml @@ -0,0 +1,15 @@ +codecov: + require_ci_to_pass: yes + notify: + wait_for_ci: yes +coverage: + status: + project: # checks the effect for the overall code coverage rate of the repository. + default: + enabled: yes + threshold: null + target: auto + patch: # This status indicates the extent of code coverage achieved by the pull request. + default: + target: 80% + threshold: 40% # With a target of 80% and a threshold of 40%, the acceptable coverage range is 40% to 80%. diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/pom.xml b/components/action-mgt/org.wso2.carbon.identity.action.execution/pom.xml index 3e0ee2e83970..02d8dc9c6cd1 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/pom.xml +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework action-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -163,7 +163,7 @@ LINE COVEREDRATIO - 0.80 + 0.79 COMPLEXITY diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutionResponseProcessor.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutionResponseProcessor.java index 1b3feb4eb7f2..6d1a434c9fe7 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutionResponseProcessor.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutionResponseProcessor.java @@ -21,10 +21,12 @@ import org.wso2.carbon.identity.action.execution.exception.ActionExecutionResponseProcessorException; import org.wso2.carbon.identity.action.execution.model.ActionExecutionStatus; import org.wso2.carbon.identity.action.execution.model.ActionInvocationErrorResponse; +import org.wso2.carbon.identity.action.execution.model.ActionInvocationFailureResponse; import org.wso2.carbon.identity.action.execution.model.ActionInvocationSuccessResponse; import org.wso2.carbon.identity.action.execution.model.ActionType; import org.wso2.carbon.identity.action.execution.model.Event; +import java.util.HashMap; import java.util.Map; /** @@ -45,4 +47,12 @@ ActionExecutionStatus processErrorResponse(Map eventContext, Event actionEvent, ActionInvocationErrorResponse errorResponse) throws ActionExecutionResponseProcessorException; + + default ActionExecutionStatus processFailureResponse(Map eventContext, + Event actionEvent, + ActionInvocationFailureResponse failureResponse) throws + ActionExecutionResponseProcessorException { + + return new ActionExecutionStatus(ActionExecutionStatus.Status.FAILED, new HashMap<>()); + } } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutionResponseProcessorFactory.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutionResponseProcessorFactory.java index f0ca7e5039a8..3ab416a1238e 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutionResponseProcessorFactory.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutionResponseProcessorFactory.java @@ -38,6 +38,8 @@ public static ActionExecutionResponseProcessor getActionExecutionResponseProcess switch (actionType) { case PRE_ISSUE_ACCESS_TOKEN: return actionInvocationResponseProcessors.get(ActionType.PRE_ISSUE_ACCESS_TOKEN); + case AUTHENTICATION: + return actionInvocationResponseProcessors.get(ActionType.AUTHENTICATION); default: return null; } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutorServiceImpl.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutorServiceImpl.java index 4da6761c4c14..a82db5cc4939 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutorServiceImpl.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/ActionExecutorServiceImpl.java @@ -32,6 +32,7 @@ import org.wso2.carbon.identity.action.execution.model.ActionExecutionRequest; import org.wso2.carbon.identity.action.execution.model.ActionExecutionStatus; import org.wso2.carbon.identity.action.execution.model.ActionInvocationErrorResponse; +import org.wso2.carbon.identity.action.execution.model.ActionInvocationFailureResponse; import org.wso2.carbon.identity.action.execution.model.ActionInvocationResponse; import org.wso2.carbon.identity.action.execution.model.ActionInvocationSuccessResponse; import org.wso2.carbon.identity.action.execution.model.ActionType; @@ -46,7 +47,7 @@ import org.wso2.carbon.identity.action.management.exception.ActionMgtException; import org.wso2.carbon.identity.action.management.model.Action; import org.wso2.carbon.identity.action.management.model.AuthProperty; -import org.wso2.carbon.identity.action.management.model.AuthType; +import org.wso2.carbon.identity.action.management.model.Authentication; import java.util.ArrayList; import java.util.List; @@ -221,7 +222,7 @@ private ActionExecutionStatus executeAction(Action action, ActionExecutionResponseProcessor actionExecutionResponseProcessor) throws ActionExecutionRuntimeException { - AuthType endpointAuthentication = action.getEndpoint().getAuthentication(); + Authentication endpointAuthentication = action.getEndpoint().getAuthentication(); AuthMethods.AuthMethod authenticationMethod; try { @@ -280,6 +281,9 @@ private ActionExecutionStatus processActionResponse(Action action, return processSuccessResponse(action, (ActionInvocationSuccessResponse) actionInvocationResponse.getResponse(), eventContext, actionRequest, actionExecutionResponseProcessor); + } else if (actionInvocationResponse.isFailure() && actionInvocationResponse.getResponse() != null) { + return processFailureResponse(action, (ActionInvocationFailureResponse) actionInvocationResponse + .getResponse(), eventContext, actionRequest, actionExecutionResponseProcessor); } else if (actionInvocationResponse.isError() && actionInvocationResponse.getResponse() != null) { return processErrorResponse(action, (ActionInvocationErrorResponse) actionInvocationResponse.getResponse(), eventContext, actionRequest, actionExecutionResponseProcessor); @@ -325,6 +329,19 @@ private ActionExecutionStatus processErrorResponse(Action action, errorResponse); } + private ActionExecutionStatus processFailureResponse(Action action, + ActionInvocationFailureResponse failureResponse, + Map eventContext, + ActionExecutionRequest actionRequest, + ActionExecutionResponseProcessor + actionExecutionResponseProcessor) + throws ActionExecutionResponseProcessorException { + + logFailureResponse(action, failureResponse); + return actionExecutionResponseProcessor.processFailureResponse(eventContext, actionRequest.getEvent(), + failureResponse); + } + private void logSuccessResponse(Action action, ActionInvocationSuccessResponse successResponse) { try { @@ -364,6 +381,27 @@ private void logErrorResponse(Action action, ActionInvocationErrorResponse error } } + private void logFailureResponse(Action action, ActionInvocationFailureResponse failureResponse) { + + if (LOG.isDebugEnabled()) { + // todo: add to diagnostic logs + try { + String responseBody = serializeFailureResponse(failureResponse); + LOG.debug(String.format( + "Received failure response from API: %s for action type: %s action id: %s with " + + "authentication: %s. Response: %s", + action.getEndpoint().getUri(), + action.getType().getActionType(), + action.getId(), + action.getEndpoint().getAuthentication().getType(), + responseBody)); + } catch (JsonProcessingException e) { + LOG.debug("Error occurred while deserializing the failure response for action: " + + action.getId() + " for action type: " + action.getType().getActionType(), e); + } + } + } + private void logErrorResponse(Action action, ActionInvocationResponse actionInvocationResponse) { // todo: add to diagnostic logs if (LOG.isDebugEnabled()) { @@ -398,6 +436,12 @@ private String serializeErrorResponse(ActionInvocationErrorResponse response) th return objectMapper.writeValueAsString(response); } + private String serializeFailureResponse(ActionInvocationFailureResponse response) throws JsonProcessingException { + + ObjectMapper objectMapper = new ObjectMapper(); + return objectMapper.writeValueAsString(response); + } + private List validatePerformableOperations(ActionExecutionRequest request, ActionInvocationSuccessResponse response) { @@ -429,12 +473,12 @@ private List validatePerformableOperations(ActionExecution return allowedPerformableOperations; } - private AuthMethods.AuthMethod getAuthenticationMethod(String actionId, AuthType authType) + private AuthMethods.AuthMethod getAuthenticationMethod(String actionId, Authentication authentication) throws ActionMgtException { - List authProperties = authType.getPropertiesWithDecryptedValues(actionId); + List authProperties = authentication.getPropertiesWithDecryptedValues(actionId); - switch (authType.getType()) { + switch (authentication.getType()) { case BASIC: return new AuthMethods.BasicAuth(authProperties); case BEARER: @@ -444,7 +488,7 @@ private AuthMethods.AuthMethod getAuthenticationMethod(String actionId, AuthType case NONE: return null; default: - throw new ActionMgtException("Unsupported authentication type: " + authType.getType()); + throw new ActionMgtException("Unsupported authentication type: " + authentication.getType()); } } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionInvocationFailureResponse.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionInvocationFailureResponse.java new file mode 100644 index 000000000000..74f59becacf9 --- /dev/null +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionInvocationFailureResponse.java @@ -0,0 +1,106 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.action.execution.model; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; + +/** + * This class is used to represent the failure response of an action invocation. + * This response will contain the failure reason and the failure description. + */ +@JsonDeserialize(builder = ActionInvocationFailureResponse.Builder.class) +public class ActionInvocationFailureResponse implements ActionInvocationResponse.APIResponse { + + private final ActionInvocationResponse.Status actionStatus; + private final String failureReason; + private final String failureDescription; + + private ActionInvocationFailureResponse(ActionInvocationFailureResponse.Builder builder) { + + this.actionStatus = builder.actionStatus; + this.failureReason = builder.failureReason; + this.failureDescription = builder.failureDescription; + } + + public ActionInvocationResponse.Status getActionStatus() { + + return actionStatus; + } + + public String getFailureReason() { + + return failureReason; + } + + public String getFailureDescription() { + + return failureDescription; + } + + /** + * This class is used to build the {@link ActionInvocationFailureResponse}. + */ + @JsonPOJOBuilder(withPrefix = "") + public static class Builder { + + private ActionInvocationResponse.Status actionStatus; + private String failureReason; + private String failureDescription; + + @JsonProperty("actionStatus") + public ActionInvocationFailureResponse.Builder actionStatus(ActionInvocationResponse.Status actionStatus) { + + this.actionStatus = actionStatus; + return this; + } + + @JsonProperty("failureReason") + public ActionInvocationFailureResponse.Builder failureReason(String failureReason) { + + this.failureReason = failureReason; + return this; + } + + @JsonProperty("failureDescription") + public ActionInvocationFailureResponse.Builder failureDescription(String failureDescription) { + + this.failureDescription = failureDescription; + return this; + } + + public ActionInvocationFailureResponse build() { + + if (actionStatus == null) { + throw new IllegalArgumentException("The actionStatus must not be null."); + } + + if (!ActionInvocationResponse.Status.FAILED.equals(actionStatus)) { + throw new IllegalArgumentException("The actionStatus must be FAILED."); + } + + if (failureReason == null || failureReason.isEmpty()) { + throw new IllegalArgumentException("The failureReason cannot be null or empty."); + } + + return new ActionInvocationFailureResponse(this); + } + } +} diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionInvocationResponse.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionInvocationResponse.java index 03cc7dab3663..abe512e8db43 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionInvocationResponse.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionInvocationResponse.java @@ -45,6 +45,11 @@ public boolean isSuccess() { return Status.SUCCESS.equals(actionStatus); } + public boolean isFailure() { + + return Status.FAILED.equals(actionStatus); + } + public boolean isError() { return Status.ERROR.equals(actionStatus); @@ -65,6 +70,7 @@ public String getErrorLog() { */ public enum Status { SUCCESS, + FAILED, ERROR } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionType.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionType.java index 5b1c1df4e0b3..a398409714b0 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionType.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/ActionType.java @@ -24,4 +24,5 @@ */ public enum ActionType { PRE_ISSUE_ACCESS_TOKEN, + AUTHENTICATION } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/Operation.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/Operation.java index 65414f717062..4674a6f50292 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/Operation.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/model/Operation.java @@ -29,7 +29,8 @@ public enum Operation { ADD("add"), REMOVE("remove"), - REPLACE("replace"); + REPLACE("replace"), + REDIRECT("redirect"); private final String value; diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/ActionExecutorConfig.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/ActionExecutorConfig.java index d0808101b01a..ff29ff9262f0 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/ActionExecutorConfig.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/ActionExecutorConfig.java @@ -24,6 +24,7 @@ import org.wso2.carbon.identity.action.execution.model.ActionType; import org.wso2.carbon.identity.core.util.IdentityConfigParser; +import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; @@ -54,7 +55,7 @@ public static ActionExecutorConfig getInstance() { } /** - * Returns a boolean value based on the system configuration: 'actions.types.pre_issue_access_token.enable' that + * Returns a boolean value based on the system configuration: 'actions.types.{action_type}.enable' that * enables or disables action execution for the given action type. * * @param actionType Action Type @@ -65,6 +66,8 @@ public boolean isExecutionForActionTypeEnabled(ActionType actionType) { switch (actionType) { case PRE_ISSUE_ACCESS_TOKEN: return isActionTypeEnabled(ActionTypeConfig.PRE_ISSUE_ACCESS_TOKEN.getActionTypeEnableProperty()); + case AUTHENTICATION: + return isActionTypeEnabled(ActionTypeConfig.AUTHENTICATION.getActionTypeEnableProperty()); default: return false; } @@ -92,17 +95,20 @@ private boolean isActionTypeEnabled(String actionTypePropertyName) { public Set getExcludedHeadersInActionRequestForActionType(ActionType actionType) { Set excludedHeaders = getExcludedHeadersInActionRequestForAllTypes(); - + List excludedHeadersPropertyValue = new ArrayList<>(); switch (actionType) { case PRE_ISSUE_ACCESS_TOKEN: - List excludedHeadersPropertyValue = getPropertyValues( + excludedHeadersPropertyValue = getPropertyValues( ActionTypeConfig.PRE_ISSUE_ACCESS_TOKEN.getExcludedHeadersProperty()); - excludedHeaders.addAll(excludedHeadersPropertyValue); + break; + case AUTHENTICATION: + excludedHeadersPropertyValue = getPropertyValues( + ActionTypeConfig.AUTHENTICATION.getExcludedHeadersProperty()); break; default: break; } - + excludedHeaders.addAll(excludedHeadersPropertyValue); return Collections.unmodifiableSet(excludedHeaders); } @@ -124,17 +130,21 @@ private Set getExcludedHeadersInActionRequestForAllTypes() { public Set getExcludedParamsInActionRequestForActionType(ActionType actionType) { Set excludedParams = getExcludedParamsInActionRequestForAllTypes(); - + List excludedParamsPropertyValue = new ArrayList<>(); switch (actionType) { case PRE_ISSUE_ACCESS_TOKEN: - List excludedParamsPropertyValue = getPropertyValues( + excludedParamsPropertyValue = getPropertyValues( ActionTypeConfig.PRE_ISSUE_ACCESS_TOKEN.getExcludedParamsProperty()); - excludedParams.addAll(excludedParamsPropertyValue); + + break; + case AUTHENTICATION: + excludedParamsPropertyValue = getPropertyValues( + ActionTypeConfig.AUTHENTICATION.getExcludedParamsProperty()); break; default: break; } - + excludedParams.addAll(excludedParamsPropertyValue); return Collections.unmodifiableSet(excludedParams); } @@ -173,7 +183,10 @@ private List getPropertyValues(String propertyKey) { private static enum ActionTypeConfig { PRE_ISSUE_ACCESS_TOKEN("Actions.Types.PreIssueAccessToken.Enable", "Actions.Types.PreIssueAccessToken.ActionRequest.ExcludedHeaders.Header", - "Actions.Types.PreIssueAccessToken.ActionRequest.ExcludedParameters.Parameter"); + "Actions.Types.PreIssueAccessToken.ActionRequest.ExcludedParameters.Parameter"), + AUTHENTICATION("Actions.Types.Authentication.Enable", + "Actions.Types.Authentication.ActionRequest.ExcludedHeaders.Header", + "Actions.Types.Authentication.ActionRequest.ExcludedParameters.Parameter"); private final String actionTypeEnableProperty; private final String excludedHeadersProperty; diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/AuthMethods.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/AuthMethods.java index c6bb1ab33318..758802b797b7 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/AuthMethods.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/main/java/org/wso2/carbon/identity/action/execution/util/AuthMethods.java @@ -20,6 +20,7 @@ import org.apache.http.client.methods.HttpPost; import org.wso2.carbon.identity.action.management.model.AuthProperty; +import org.wso2.carbon.identity.action.management.model.Authentication; import java.nio.charset.StandardCharsets; import java.util.Base64; @@ -55,7 +56,8 @@ public static final class BearerAuth implements AuthMethod { public BearerAuth(List authPropertyList) { authPropertyList.stream() - .filter(authProperty -> "ACCESS_TOKEN".equals(authProperty.getName())) + .filter(authProperty -> Authentication.Property.ACCESS_TOKEN.getName(). + equals(authProperty.getName())) .findFirst() .ifPresent(authProperty -> this.token = authProperty.getValue()); } @@ -69,7 +71,7 @@ public void applyAuth(HttpPost httpPost) { @Override public String getAuthType() { - return "BEARER"; + return Authentication.Type.BEARER.getName(); } } @@ -84,15 +86,10 @@ public static final class BasicAuth implements AuthMethod { public BasicAuth(List authPropertyList) { authPropertyList.forEach(authProperty -> { - switch (authProperty.getName()) { - case "USERNAME": - this.username = authProperty.getValue(); - break; - case "PASSWORD": - this.password = authProperty.getValue(); - break; - default: - break; + if (Authentication.Property.USERNAME.getName().equals(authProperty.getName())) { + this.username = authProperty.getValue(); + } else if (Authentication.Property.PASSWORD.getName().equals(authProperty.getName())) { + this.password = authProperty.getValue(); } }); } @@ -109,7 +106,7 @@ public void applyAuth(HttpPost httpPost) { @Override public String getAuthType() { - return "BASIC"; + return Authentication.Type.BASIC.getName(); } } @@ -124,15 +121,10 @@ public static final class APIKeyAuth implements AuthMethod { public APIKeyAuth(List authPropertyList) { authPropertyList.forEach(authProperty -> { - switch (authProperty.getName()) { - case "HEADER": - this.apiHeader = authProperty.getValue(); - break; - case "VALUE": - this.apiKey = authProperty.getValue(); - break; - default: - break; + if (Authentication.Property.HEADER.getName().equals(authProperty.getName())) { + this.apiHeader = authProperty.getValue(); + } else if (Authentication.Property.VALUE.getName().equals(authProperty.getName())) { + this.apiKey = authProperty.getValue(); } }); } @@ -146,7 +138,7 @@ public void applyAuth(HttpPost httpPost) { @Override public String getAuthType() { - return "API-KEY"; + return Authentication.Type.API_KEY.getName(); } } } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/ActionExecutorServiceImplTest.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/ActionExecutorServiceImplTest.java index 9071c65e41cc..85d7fdc284e9 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/ActionExecutorServiceImplTest.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/ActionExecutorServiceImplTest.java @@ -34,6 +34,7 @@ import org.wso2.carbon.identity.action.execution.model.ActionExecutionRequest; import org.wso2.carbon.identity.action.execution.model.ActionExecutionStatus; import org.wso2.carbon.identity.action.execution.model.ActionInvocationErrorResponse; +import org.wso2.carbon.identity.action.execution.model.ActionInvocationFailureResponse; import org.wso2.carbon.identity.action.execution.model.ActionInvocationResponse; import org.wso2.carbon.identity.action.execution.model.ActionInvocationSuccessResponse; import org.wso2.carbon.identity.action.execution.model.ActionType; @@ -51,8 +52,7 @@ import org.wso2.carbon.identity.action.management.ActionManagementService; import org.wso2.carbon.identity.action.management.exception.ActionMgtException; import org.wso2.carbon.identity.action.management.model.Action; -import org.wso2.carbon.identity.action.management.model.AuthProperty; -import org.wso2.carbon.identity.action.management.model.AuthType; +import org.wso2.carbon.identity.action.management.model.Authentication; import org.wso2.carbon.identity.action.management.model.EndpointConfig; import java.lang.reflect.Field; @@ -304,6 +304,49 @@ public void testExecuteSuccess() throws Exception { assertEquals(actualStatus.getStatus(), expectedStatus.getStatus()); } + @Test + public void testExecuteFailure() throws Exception { + // Setup + ActionType actionType = ActionType.PRE_ISSUE_ACCESS_TOKEN; + Map eventContext = Collections.emptyMap(); + + // Mock Action and its dependencies + Action action = createAction(); + + // Mock ActionManagementService + when(actionManagementService.getActionsByActionType(any(), any())).thenReturn( + Collections.singletonList(action)); + + // Mock ActionRequestBuilder and ActionResponseProcessor + actionExecutionRequestBuilderFactory.when( + () -> ActionExecutionRequestBuilderFactory.getActionExecutionRequestBuilder(any())) + .thenReturn(actionExecutionRequestBuilder); + actionExecutionResponseProcessorFactory.when(() -> ActionExecutionResponseProcessorFactory + .getActionExecutionResponseProcessor(any())) + .thenReturn(actionExecutionResponseProcessor); + + // Configure request builder + when(actionExecutionRequestBuilder.getSupportedActionType()).thenReturn(actionType); + when(actionExecutionRequestBuilder.buildActionExecutionRequest(eventContext)).thenReturn( + mock(ActionExecutionRequest.class)); + + // Mock APIClient response + ActionInvocationResponse actionInvocationResponse = createFailureActionInvocationResponse(); + when(apiClient.callAPI(any(), any(), any())).thenReturn(actionInvocationResponse); + + // Configure response processor + ActionExecutionStatus expectedStatus = + new ActionExecutionStatus(ActionExecutionStatus.Status.FAILED, eventContext); + when(actionExecutionResponseProcessor.getSupportedActionType()).thenReturn(actionType); + when(actionExecutionResponseProcessor.processFailureResponse(any(), any(), any())).thenReturn( + expectedStatus); + + // Execute and assert + ActionExecutionStatus actualStatus = + actionExecutorService.execute(actionType, eventContext, "tenantDomain"); + assertEquals(actualStatus.getStatus(), expectedStatus.getStatus()); + } + @Test public void testExecuteError() throws Exception { // Setup @@ -337,7 +380,7 @@ public void testExecuteError() throws Exception { // Configure response processor ActionExecutionStatus expectedStatus = - new ActionExecutionStatus(ActionExecutionStatus.Status.FAILED, eventContext); + new ActionExecutionStatus(ActionExecutionStatus.Status.ERROR, eventContext); when(actionExecutionResponseProcessor.getSupportedActionType()).thenReturn(actionType); when(actionExecutionResponseProcessor.processErrorResponse(any(), any(), any())).thenReturn( expectedStatus); @@ -348,26 +391,6 @@ public void testExecuteError() throws Exception { assertEquals(actualStatus.getStatus(), expectedStatus.getStatus()); } - private List createAuthProperties() { - - List authPropertyList = new ArrayList<>(); - for (AuthType.AuthenticationType.AuthenticationProperty property : - AuthType.AuthenticationType.BASIC.getProperties()) { - AuthProperty authProperty; - if (property.getName().equals("username")) { - authProperty = new AuthProperty.AuthPropertyBuilder().name(property.getName()).value("testuser") - .isConfidential(true).build(); - } else if (property.getName().equals("password")) { - authProperty = new AuthProperty.AuthPropertyBuilder().name(property.getName()).value("testpassword") - .isConfidential(true).build(); - } else { - authProperty = new AuthProperty.AuthPropertyBuilder().name(property.getName()).value("unknown").build(); - } - authPropertyList.add(authProperty); - } - return authPropertyList; - } - private String getJSONRequestPayload(ActionExecutionRequest actionExecutionRequest) throws JsonProcessingException { ObjectMapper requestObjectmapper = new ObjectMapper(); @@ -389,6 +412,20 @@ private ActionInvocationResponse createSuccessActionInvocationResponse() throws return actionInvocationResponse; } + private ActionInvocationResponse createFailureActionInvocationResponse() { + + ActionInvocationFailureResponse failureResponse = mock(ActionInvocationFailureResponse.class); + when(failureResponse.getActionStatus()).thenReturn(ActionInvocationResponse.Status.FAILED); + when(failureResponse.getFailureReason()).thenReturn("User is not found"); + when(failureResponse.getFailureReason()).thenReturn("User is not found in the ABC system. " + + "Hence unable to authenticate user."); + + ActionInvocationResponse actionInvocationResponse = mock(ActionInvocationResponse.class); + when(actionInvocationResponse.isFailure()).thenReturn(true); + when(actionInvocationResponse.getResponse()).thenReturn(failureResponse); + return actionInvocationResponse; + } + private ActionInvocationResponse createErrorActionInvocationResponse() { ActionInvocationErrorResponse errorResponse = mock(ActionInvocationErrorResponse.class); @@ -442,12 +479,14 @@ private Action createAction() throws ActionMgtException { when(action.getEndpoint()).thenReturn(endpointConfig); when(endpointConfig.getUri()).thenReturn("http://example.com"); - // Mock AuthType and its properties - List authPropertyList = createAuthProperties(); - AuthType authType = mock(AuthType.class); - when(authType.getPropertiesWithDecryptedValues(any())).thenReturn(authPropertyList); - when(authType.getType()).thenReturn(AuthType.AuthenticationType.BASIC); - when(endpointConfig.getAuthentication()).thenReturn(authType); + // Mock Authentication and its properties + Authentication mockAuthenticationConfig = new Authentication.BasicAuthBuilder("testuser", + "testpassword").build(); + Authentication authenticationConfig = mock(Authentication.class); + when(authenticationConfig.getPropertiesWithDecryptedValues(any())) + .thenReturn(mockAuthenticationConfig.getProperties()); + when(authenticationConfig.getType()).thenReturn(mockAuthenticationConfig.getType()); + when(endpointConfig.getAuthentication()).thenReturn(authenticationConfig); return action; } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/util/AuthMethodsTest.java b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/util/AuthMethodsTest.java index 13981b8435e8..d071b0fc39a4 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/util/AuthMethodsTest.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.execution/src/test/java/org/wso2/carbon/identity/action/execution/util/AuthMethodsTest.java @@ -24,6 +24,7 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import org.wso2.carbon.identity.action.management.model.AuthProperty; +import org.wso2.carbon.identity.action.management.model.Authentication; import java.util.Arrays; import java.util.Base64; @@ -49,14 +50,16 @@ public void setUp() { @Test public void testBearerAuth() { - AuthProperty accessTokenProperty = - new AuthProperty.AuthPropertyBuilder().name("ACCESS_TOKEN").isConfidential(true).value("testToken") - .build(); + AuthProperty accessTokenProperty = new AuthProperty.AuthPropertyBuilder() + .name(Authentication.Property.ACCESS_TOKEN.getName()) + .isConfidential(true) + .value("testToken") + .build(); List authProperties = Collections.singletonList(accessTokenProperty); AuthMethods.BearerAuth bearerAuth = new AuthMethods.BearerAuth(authProperties); - assertEquals("BEARER", bearerAuth.getAuthType()); + assertEquals(Authentication.Type.BEARER.getName(), bearerAuth.getAuthType()); bearerAuth.applyAuth(httpPost); verify(httpPost).setHeader("Authorization", "Bearer testToken"); @@ -65,15 +68,21 @@ public void testBearerAuth() { @Test public void testBasicAuth() { - AuthProperty usernameProperty = - new AuthProperty.AuthPropertyBuilder().name("USERNAME").isConfidential(true).value("testUser").build(); - AuthProperty passwordProperty = - new AuthProperty.AuthPropertyBuilder().name("PASSWORD").isConfidential(true).value("testPass").build(); + AuthProperty usernameProperty = new AuthProperty.AuthPropertyBuilder() + .name(Authentication.Property.USERNAME.getName()) + .isConfidential(true) + .value("testUser") + .build(); + AuthProperty passwordProperty = new AuthProperty.AuthPropertyBuilder() + .name(Authentication.Property.PASSWORD.getName()) + .isConfidential(true) + .value("testPass") + .build(); List authProperties = Arrays.asList(usernameProperty, passwordProperty); AuthMethods.BasicAuth basicAuth = new AuthMethods.BasicAuth(authProperties); - assertEquals("BASIC", basicAuth.getAuthType()); + assertEquals(Authentication.Type.BASIC.getName(), basicAuth.getAuthType()); basicAuth.applyAuth(httpPost); String expectedAuthHeader = "Basic " + new String(Base64.getEncoder().encode("testUser:testPass".getBytes())); @@ -83,15 +92,21 @@ public void testBasicAuth() { @Test public void testAPIKeyAuth() { - AuthProperty headerProperty = - new AuthProperty.AuthPropertyBuilder().name("HEADER").isConfidential(false).value("x-api-key").build(); - AuthProperty valueProperty = - new AuthProperty.AuthPropertyBuilder().name("VALUE").isConfidential(true).value("testApiKey").build(); + AuthProperty headerProperty = new AuthProperty.AuthPropertyBuilder() + .name(Authentication.Property.HEADER.getName()) + .isConfidential(false) + .value("x-api-key") + .build(); + AuthProperty valueProperty = new AuthProperty.AuthPropertyBuilder() + .name(Authentication.Property.VALUE.getName()) + .isConfidential(true) + .value("testApiKey") + .build(); List authProperties = Arrays.asList(headerProperty, valueProperty); AuthMethods.APIKeyAuth apiKeyAuth = new AuthMethods.APIKeyAuth(authProperties); - assertEquals("API-KEY", apiKeyAuth.getAuthType()); + assertEquals(Authentication.Type.API_KEY.getName(), apiKeyAuth.getAuthType()); apiKeyAuth.applyAuth(httpPost); verify(httpPost).setHeader("x-api-key", "testApiKey"); diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/pom.xml b/components/action-mgt/org.wso2.carbon.identity.action.management/pom.xml index 13a8a050d119..4b6c8cef56f8 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/pom.xml +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework action-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -156,7 +156,9 @@ COMPLEXITY COVEREDRATIO - 0.50 + + 0.49 diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionManagementService.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionManagementService.java index 9f6416320bde..fe1851cb1b13 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionManagementService.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionManagementService.java @@ -20,7 +20,7 @@ import org.wso2.carbon.identity.action.management.exception.ActionMgtException; import org.wso2.carbon.identity.action.management.model.Action; -import org.wso2.carbon.identity.action.management.model.AuthType; +import org.wso2.carbon.identity.action.management.model.Authentication; import java.util.List; import java.util.Map; @@ -108,12 +108,13 @@ Action updateAction(String actionType, String actionId, Action action, String te /** * Get Action of a given Action ID. * - * @param actionId Action ID. + * @param actionType Action Type. + * @param actionId Action Id. * @param tenantDomain Tenant domain. * @return Action response. * @throws ActionMgtException If an error occurs while retrieving the Action of a given Action ID. */ - Action getActionByActionId(String actionId, String tenantDomain) throws ActionMgtException; + Action getActionByActionId(String actionType, String actionId, String tenantDomain) throws ActionMgtException; /** * Update the authentication of the action endpoint. @@ -125,6 +126,6 @@ Action updateAction(String actionType, String actionId, Action action, String te * @return Action response after update. * @throws ActionMgtException If an error occurs while updating action endpoint authentication information. */ - Action updateActionEndpointAuthentication(String actionType, String actionId, AuthType authentication, + Action updateActionEndpointAuthentication(String actionType, String actionId, Authentication authentication, String tenantDomain) throws ActionMgtException; } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionManagementServiceImpl.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionManagementServiceImpl.java index e1e0dd84b923..e0499ee07b90 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionManagementServiceImpl.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionManagementServiceImpl.java @@ -26,7 +26,7 @@ import org.wso2.carbon.identity.action.management.exception.ActionMgtClientException; import org.wso2.carbon.identity.action.management.exception.ActionMgtException; import org.wso2.carbon.identity.action.management.model.Action; -import org.wso2.carbon.identity.action.management.model.AuthType; +import org.wso2.carbon.identity.action.management.model.Authentication; import org.wso2.carbon.identity.action.management.model.EndpointConfig; import org.wso2.carbon.identity.action.management.util.ActionManagementUtil; import org.wso2.carbon.identity.core.util.IdentityTenantUtil; @@ -140,22 +140,24 @@ public Map getActionsCountPerType(String tenantDomain) throws A } @Override - public Action getActionByActionId(String actionId, String tenantDomain) throws ActionMgtException { + public Action getActionByActionId(String actionType, String actionId, String tenantDomain) + throws ActionMgtException { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Retrieving Action of Action ID: %s", actionId)); } - return CACHE_BACKED_DAO.getActionByActionId(actionId, IdentityTenantUtil.getTenantId(tenantDomain)); + return CACHE_BACKED_DAO.getActionByActionId(getActionTypeFromPath(actionType), actionId, + IdentityTenantUtil.getTenantId(tenantDomain)); } @Override - public Action updateActionEndpointAuthentication(String actionType, String actionId, AuthType authentication, + public Action updateActionEndpointAuthentication(String actionType, String actionId, Authentication authentication, String tenantDomain) throws ActionMgtException { String resolvedActionType = getActionTypeFromPath(actionType); Action existingAction = checkIfActionExists(resolvedActionType, actionId, tenantDomain); if (existingAction.getEndpoint().getAuthentication().getType().equals(authentication.getType())) { - // Only need to update the properties since the authType is same. + // Only need to update the properties since the authentication type is same. return updateEndpointAuthenticationProperties(resolvedActionType, actionId, authentication, tenantDomain); } else { // Need to update the authentication type and properties. @@ -208,7 +210,8 @@ private void validateMaxActionsPerType(String actionType, String tenantDomain) t private Action checkIfActionExists(String actionType, String actionId, String tenantDomain) throws ActionMgtException { - Action action = CACHE_BACKED_DAO.getActionByActionId(actionId, IdentityTenantUtil.getTenantId(tenantDomain)); + Action action = CACHE_BACKED_DAO.getActionByActionId(actionType, actionId, + IdentityTenantUtil.getTenantId(tenantDomain)); if (action == null || !actionType.equals(action.getType().name())) { throw ActionManagementUtil.handleClientException( ActionMgtConstants.ErrorMessages.ERROR_NO_ACTION_CONFIGURED_ON_GIVEN_ACTION_TYPE_AND_ID); @@ -228,12 +231,13 @@ private Action checkIfActionExists(String actionType, String actionId, String te * @throws ActionMgtException If an error occurs while updating action endpoint authentication. */ private Action updateEndpoint(String actionType, String actionId, Action existingAction, - AuthType authentication, String tenantDomain) + Authentication authentication, String tenantDomain) throws ActionMgtException { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Updating endpoint authentication of Action Type: %s " + - "and Action ID: %s to AuthType: %s", actionType, actionId, authentication.getType().name())); + "and Action ID: %s to Authentication Type: %s", actionType, actionId, + authentication.getType().name())); } EndpointConfig endpoint = new EndpointConfig.EndpointConfigBuilder() .uri(existingAction.getEndpoint().getUri()) @@ -252,14 +256,16 @@ private Action updateEndpoint(String actionType, String actionId, Action existin * @return Action response after update. * @throws ActionMgtException If an error occurs while updating action endpoint authentication properties. */ - private Action updateEndpointAuthenticationProperties(String actionType, String actionId, AuthType authentication, - String tenantDomain) throws ActionMgtException { + private Action updateEndpointAuthenticationProperties(String actionType, String actionId, + Authentication authentication, String tenantDomain) + throws ActionMgtException { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Updating endpoint authentication properties of Action Type: %s " + - "Action ID: %s and AuthType: %s", actionType, actionId, authentication.getType().name())); + "Action ID: %s and Authentication Type: %s", actionType, actionId, + authentication.getType().name())); } - return CACHE_BACKED_DAO.updateActionEndpointAuthProperties(actionId, authentication, + return CACHE_BACKED_DAO.updateActionEndpointAuthProperties(actionType, actionId, authentication, IdentityTenantUtil.getTenantId(tenantDomain)); } } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionSecretProcessor.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionSecretProcessor.java index 861f085b8671..6bbb598350f7 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionSecretProcessor.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/ActionSecretProcessor.java @@ -20,7 +20,7 @@ import org.wso2.carbon.identity.action.management.internal.ActionMgtServiceComponentHolder; import org.wso2.carbon.identity.action.management.model.AuthProperty; -import org.wso2.carbon.identity.action.management.model.AuthType; +import org.wso2.carbon.identity.action.management.model.Authentication; import org.wso2.carbon.identity.secret.mgt.core.exception.SecretManagementException; import org.wso2.carbon.identity.secret.mgt.core.model.ResolvedSecret; import org.wso2.carbon.identity.secret.mgt.core.model.Secret; @@ -39,7 +39,7 @@ public class ActionSecretProcessor { public ActionSecretProcessor() { } - public List encryptAssociatedSecrets(AuthType authentication, String actionId) + public List encryptAssociatedSecrets(Authentication authentication, String actionId) throws SecretManagementException { List encryptedAuthProperties = new ArrayList<>(); @@ -69,7 +69,7 @@ public List decryptAssociatedSecrets(List authProper return decryptedAuthProperties; } - public void deleteAssociatedSecrets(AuthType authentication, String actionId) + public void deleteAssociatedSecrets(Authentication authentication, String actionId) throws SecretManagementException { for (AuthProperty authProperty : authentication.getProperties()) { diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtConstants.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtConstants.java index 02cffaaf25f0..b9d0b109206f 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtConstants.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtConstants.java @@ -70,7 +70,10 @@ public enum ErrorMessages { "Error while retrieving Action basic info from the system."), ERROR_WHILE_DECRYPTING_ACTION_ENDPOINT_AUTH_PROPERTIES("65012", "Error while decrypting Action Endpoint Authentication properties", - "Error while decrypting Action Endpoint Authentication properties in the system."); + "Error while decrypting Action Endpoint Authentication properties in the system."), + ERROR_NO_AUTHENTICATION_TYPE("65013", + "Error while retrieving Action Endpoint Authentication configurations", + "Authentication type is not defined for the Action Endpoint."); private final String code; private final String message; diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtSQLConstants.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtSQLConstants.java index bb267a2dc683..b41fb5282228 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtSQLConstants.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/constant/ActionMgtSQLConstants.java @@ -59,7 +59,7 @@ public static class Query { "PROPERTY_NAME, PROPERTY_VALUE, TENANT_ID) VALUES (:ACTION_UUID;, :PROPERTY_NAME;, :PROPERTY_VALUE;, " + ":TENANT_ID;)"; public static final String GET_ACTION_BASIC_INFO_BY_ID = "SELECT TYPE, NAME, DESCRIPTION, STATUS FROM " + - "IDN_ACTION WHERE UUID = :UUID; AND TENANT_ID = :TENANT_ID;"; + "IDN_ACTION WHERE TYPE = :TYPE; AND UUID = :UUID; AND TENANT_ID = :TENANT_ID;"; public static final String GET_ACTION_ENDPOINT_INFO_BY_ID = "SELECT PROPERTY_NAME, PROPERTY_VALUE FROM " + "IDN_ACTION_ENDPOINT WHERE ACTION_UUID = :ACTION_UUID; AND TENANT_ID = :TENANT_ID;"; public static final String GET_ACTIONS_BASIC_INFO_BY_ACTION_TYPE = "SELECT UUID, TYPE, NAME, DESCRIPTION," + diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/ActionManagementDAO.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/ActionManagementDAO.java index 2bb0ee8b2f83..9def55c4247b 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/ActionManagementDAO.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/ActionManagementDAO.java @@ -20,7 +20,7 @@ import org.wso2.carbon.identity.action.management.exception.ActionMgtException; import org.wso2.carbon.identity.action.management.model.Action; -import org.wso2.carbon.identity.action.management.model.AuthType; +import org.wso2.carbon.identity.action.management.model.Authentication; import org.wso2.carbon.identity.action.management.model.EndpointConfig; import java.util.List; @@ -117,7 +117,7 @@ Action updateAction(String actionType, String actionId, Action updatingAction, A * @return Action. * @throws ActionMgtException If an error occurs while retrieving the Action of a given Action ID. */ - Action getActionByActionId(String actionId, Integer tenantId) throws ActionMgtException; + Action getActionByActionId(String actionType, String actionId, Integer tenantId) throws ActionMgtException; /** * Update the endpoint authentication properties of an {@link Action} by given Action ID. @@ -128,8 +128,8 @@ Action updateAction(String actionType, String actionId, Action updatingAction, A * @return Updated Action. * @throws ActionMgtException If an error occurs while updating the Action endpoint authentication properties. */ - Action updateActionEndpointAuthProperties(String actionId, AuthType authentication, int tenantId) - throws ActionMgtException; + Action updateActionEndpointAuthProperties(String actionType, String actionId, Authentication authentication, + int tenantId) throws ActionMgtException; /** * Update the endpoint authentication properties of an {@link Action} by given Action ID. @@ -143,5 +143,5 @@ Action updateActionEndpointAuthProperties(String actionId, AuthType authenticati * @throws ActionMgtException If an error occurs while updating the Action endpoint. */ Action updateActionEndpoint(String actionType, String actionId, EndpointConfig endpoint, - AuthType currentAuthentication, int tenantId) throws ActionMgtException; + Authentication currentAuthentication, int tenantId) throws ActionMgtException; } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOImpl.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOImpl.java index 6a881812cbd6..6ce5e31757b4 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOImpl.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/ActionManagementDAOImpl.java @@ -30,7 +30,7 @@ import org.wso2.carbon.identity.action.management.exception.ActionMgtServerException; import org.wso2.carbon.identity.action.management.model.Action; import org.wso2.carbon.identity.action.management.model.AuthProperty; -import org.wso2.carbon.identity.action.management.model.AuthType; +import org.wso2.carbon.identity.action.management.model.Authentication; import org.wso2.carbon.identity.action.management.model.EndpointConfig; import org.wso2.carbon.identity.action.management.util.ActionManagementUtil; import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil; @@ -84,7 +84,7 @@ public Action addAction(String actionType, String actionId, Action action, Integ action.getEndpoint().getAuthentication().getType().name(), encryptedAuthProperties), tenantId); IdentityDatabaseUtil.commitTransaction(dbConnection); - return getActionByActionId(actionId, tenantId); + return getActionByActionId(actionType, actionId, tenantId); } catch (SQLException | ActionMgtException e) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Error while creating the Action of Action Type: %s in Tenant Domain: %s." + @@ -160,7 +160,7 @@ public Action updateAction(String actionType, String actionId, Action updatingAc tenantId); IdentityDatabaseUtil.commitTransaction(dbConnection); - return getActionByActionId(actionId, tenantId); + return getActionByActionId(actionType, actionId, tenantId); } catch (SQLException | ActionMgtException e) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Error while updating the Action of Action Type: %s and Action ID: %s in" + @@ -241,10 +241,10 @@ public Map getActionsCountPerType(Integer tenantId) throws Acti } @Override - public Action getActionByActionId(String actionId, Integer tenantId) throws ActionMgtException { + public Action getActionByActionId(String actionType, String actionId, Integer tenantId) throws ActionMgtException { try (Connection dbConnection = IdentityDatabaseUtil.getDBConnection(false)) { - Action action = getActionBasicInfoById(dbConnection, actionId, tenantId); + Action action = getActionBasicInfoById(dbConnection, actionType, actionId, tenantId); if (action != null) { action.setEndpoint(getActionEndpointConfigById(dbConnection, actionId, tenantId)); } @@ -257,24 +257,24 @@ public Action getActionByActionId(String actionId, Integer tenantId) throws Acti } @Override - public Action updateActionEndpointAuthProperties(String actionId, AuthType authentication, int tenantId) - throws ActionMgtException { + public Action updateActionEndpointAuthProperties(String actionType, String actionId, Authentication authentication, + int tenantId) throws ActionMgtException { Connection dbConnection = IdentityDatabaseUtil.getDBConnection(true); updateActionEndpointAuthProperties(dbConnection, actionId, authentication, tenantId); IdentityDatabaseUtil.closeConnection(dbConnection); - return getActionByActionId(actionId, tenantId); + return getActionByActionId(actionType, actionId, tenantId); } @Override public Action updateActionEndpoint(String actionType, String actionId, EndpointConfig endpoint, - AuthType currentAuthentication, int tenantId) + Authentication currentAuthentication, int tenantId) throws ActionMgtException { Connection dbConnection = IdentityDatabaseUtil.getDBConnection(true); updateActionEndpoint(dbConnection, actionType, actionId, endpoint, currentAuthentication, tenantId); IdentityDatabaseUtil.closeConnection(dbConnection); - return getActionByActionId(actionId, tenantId); + return getActionByActionId(actionType, actionId, tenantId); } /** @@ -286,8 +286,9 @@ public Action updateActionEndpoint(String actionType, String actionId, EndpointC * @param tenantId Tenant Id. * @throws ActionMgtServerException If an error occurs while updating the Action endpoint authentication properties. */ - private void updateActionEndpointAuthProperties(Connection dbConnection, String actionId, AuthType authentication, - int tenantId) throws ActionMgtServerException { + private void updateActionEndpointAuthProperties(Connection dbConnection, String actionId, + Authentication authentication, int tenantId) + throws ActionMgtServerException { try { Map nonSecretEndpointProperties = authentication.getProperties().stream() @@ -323,7 +324,7 @@ private void updateActionEndpointAuthProperties(Connection dbConnection, String * @throws ActionMgtServerException If an error occurs while updating the Action endpoint. */ private void updateActionEndpoint(Connection dbConnection, String actionType, String actionId, - EndpointConfig endpoint, AuthType currentAuthentication, int tenantId) + EndpointConfig endpoint, Authentication currentAuthentication, int tenantId) throws ActionMgtServerException { try (NamedPreparedStatement statement = new NamedPreparedStatement(dbConnection, @@ -396,13 +397,14 @@ private void addEndpointProperties(Connection dbConnection, String actionId, * @return Action Basic Info. * @throws ActionMgtException If an error occurs while retrieving action basic info from the database. */ - private Action getActionBasicInfoById(Connection dbConnection, String actionId, Integer tenantId) + private Action getActionBasicInfoById(Connection dbConnection, String actionType, String actionId, Integer tenantId) throws ActionMgtException { Action action = null; try (NamedPreparedStatement statement = new NamedPreparedStatement(dbConnection, ActionMgtSQLConstants.Query.GET_ACTION_BASIC_INFO_BY_ID)) { + statement.setString(ActionMgtSQLConstants.Column.ACTION_TYPE, actionType); statement.setString(ActionMgtSQLConstants.Column.ACTION_UUID, actionId); statement.setInt(ActionMgtSQLConstants.Column.TENANT_ID, tenantId); @@ -445,9 +447,9 @@ private EndpointConfig getActionEndpointConfigById(Connection dbConnection, Stri try (ResultSet rs = statement.executeQuery()) { String endpointUri = null; - AuthType.AuthenticationType authnType = null; + Authentication authentication = null; + Authentication.Type authnType = null; Map authnPropertiesMap = new HashMap<>(); - List authnProperties = new ArrayList<>(); while (rs.next()) { String propName = rs.getString(ActionMgtSQLConstants.Column.ACTION_ENDPOINT_PROPERTY_NAME); @@ -456,7 +458,7 @@ private EndpointConfig getActionEndpointConfigById(Connection dbConnection, Stri if (propName.equals(ActionMgtConstants.URI_ATTRIBUTE)) { endpointUri = propValue; } else if (propName.equals(ActionMgtConstants.AUTHN_TYPE_ATTRIBUTE)) { - authnType = AuthType.AuthenticationType.valueOf(propValue); + authnType = Authentication.Type.valueOf(propValue); } else { // Authentication properties. authnPropertiesMap.put(propName, propValue); @@ -464,22 +466,36 @@ private EndpointConfig getActionEndpointConfigById(Connection dbConnection, Stri } if (authnType != null) { - for (AuthType.AuthenticationType.AuthenticationProperty property : authnType.getProperties()) { - if (authnPropertiesMap.containsKey(property.getName())) { - authnProperties.add(new AuthProperty.AuthPropertyBuilder() - .name(property.getName()) - .value(authnPropertiesMap.get(property.getName())) - .isConfidential(property.getIsConfidential()) - .build()); - } + switch (authnType) { + case BASIC: + authentication = new Authentication.BasicAuthBuilder( + authnPropertiesMap.get(Authentication.Property.USERNAME.getName()), + authnPropertiesMap.get(Authentication.Property.PASSWORD.getName())).build(); + break; + case BEARER: + authentication = new Authentication.BearerAuthBuilder( + authnPropertiesMap.get(Authentication.Property.ACCESS_TOKEN.getName())).build(); + break; + case API_KEY: + authentication = new Authentication.APIKeyAuthBuilder( + authnPropertiesMap.get(Authentication.Property.HEADER.getName()), + authnPropertiesMap.get(Authentication.Property.VALUE.getName())).build(); + break; + case NONE: + authentication = new Authentication.NoneAuthBuilder().build(); + break; + default: + break; } + } else { + ActionMgtConstants.ErrorMessages error = + ActionMgtConstants.ErrorMessages.ERROR_NO_AUTHENTICATION_TYPE; + throw new ActionMgtServerException(error.getMessage(), error.getDescription(), error.getCode()); } return new EndpointConfig.EndpointConfigBuilder() .uri(endpointUri) - .authentication(new AuthType.AuthTypeBuilder() - .type(authnType) - .properties(authnProperties).build()).build(); + .authentication(authentication).build(); } } catch (SQLException e) { throw ActionManagementUtil.handleServerException( @@ -566,7 +582,7 @@ private Action changeActionStatus(String actionType, String actionId, String sta statement.executeUpdate(); IdentityDatabaseUtil.commitTransaction(dbConnection); - return getActionBasicInfoById(dbConnection, actionId, tenantId); + return getActionBasicInfoById(dbConnection, actionType, actionId, tenantId); } catch (SQLException e) { if (LOG.isDebugEnabled()) { LOG.debug(String.format("Error while updating the Action Status to %s of Action type: %s in " + @@ -602,8 +618,8 @@ private void updateEndpointUriAndAuthentication(Connection dbConnection, String return; } - AuthType updatingAuthentication = updatingEndpoint.getAuthentication(); - AuthType existingAuthentication = existingAction.getEndpoint().getAuthentication(); + Authentication updatingAuthentication = updatingEndpoint.getAuthentication(); + Authentication existingAuthentication = existingAction.getEndpoint().getAuthentication(); boolean isUriUpdating = !StringUtils.isEmpty(updatingEndpoint.getUri()); boolean isAuthUpdating = updatingAuthentication != null; boolean isSameAuthType = isAuthUpdating && updatingAuthentication.getType() diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/CacheBackedActionMgtDAO.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/CacheBackedActionMgtDAO.java index ac352e3f8d7f..1ef2ff2d3ca3 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/CacheBackedActionMgtDAO.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/dao/impl/CacheBackedActionMgtDAO.java @@ -18,6 +18,7 @@ package org.wso2.carbon.identity.action.management.dao.impl; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.identity.action.management.cache.ActionCacheByType; @@ -26,7 +27,7 @@ import org.wso2.carbon.identity.action.management.dao.ActionManagementDAO; import org.wso2.carbon.identity.action.management.exception.ActionMgtException; import org.wso2.carbon.identity.action.management.model.Action; -import org.wso2.carbon.identity.action.management.model.AuthType; +import org.wso2.carbon.identity.action.management.model.Authentication; import org.wso2.carbon.identity.action.management.model.EndpointConfig; import java.util.List; @@ -124,25 +125,67 @@ public Map getActionsCountPerType(Integer tenantId) throws Acti } @Override - public Action getActionByActionId(String actionId, Integer tenantId) throws ActionMgtException { + public Action getActionByActionId(String actionType, String actionId, Integer tenantId) throws ActionMgtException { - return actionManagementDAO.getActionByActionId(actionId, tenantId); + ActionTypeCacheKey cacheKey = new ActionTypeCacheKey(actionType); + ActionCacheEntry entry = actionCacheByType.getValueFromCache(cacheKey, tenantId); + + /* If the entry for the given action type is not null, get the action list from cache and iterate to get the + action by matching action id. */ + if (entry != null) { + for (Action action: entry.getActions()) { + if (StringUtils.equals(action.getId(), actionId)) { + LOG.debug("Action is found from the cache with action Id " + actionId); + return action; + } + } + } + + if (LOG.isDebugEnabled()) { + LOG.debug("Action is not found from the cache with action Id " + actionId + ". Fetching entry from DB."); + } + + Action action = actionManagementDAO.getActionByActionId(actionType, actionId, tenantId); + if (action != null) { + updateCache(action, entry, cacheKey, tenantId); + } else { + if (LOG.isDebugEnabled()) { + LOG.debug("Action with action Id " + actionId + " is not found in cache or DB."); + } + } + + return action; } @Override - public Action updateActionEndpointAuthProperties(String actionId, AuthType authentication, int tenantId) - throws ActionMgtException { + public Action updateActionEndpointAuthProperties(String actionType, String actionId, Authentication authentication, + int tenantId) throws ActionMgtException { - return actionManagementDAO.updateActionEndpointAuthProperties(actionId, authentication, tenantId); + return actionManagementDAO.updateActionEndpointAuthProperties(actionType, actionId, authentication, tenantId); } @Override public Action updateActionEndpoint(String actionType, String actionId, EndpointConfig endpoint, - AuthType currentAuthentication, int tenantId) + Authentication currentAuthentication, int tenantId) throws ActionMgtException { actionCacheByType.clearCacheEntry(new ActionTypeCacheKey(actionType), tenantId); return actionManagementDAO.updateActionEndpoint(actionType, actionId, endpoint, currentAuthentication, tenantId); } + + private void updateCache(Action action, ActionCacheEntry entry, ActionTypeCacheKey cacheKey, int tenantId) { + + if (LOG.isDebugEnabled()) { + LOG.debug("Entry fetched from DB for Action Id " + action.getId() + ". Updating cache."); + } + /* If the entry for the given action type is not null, add the fetched action to the entry. Then, clear the + cache and add the updated entry to the cache. If the entry is null, create a new cache entry.*/ + if (entry != null) { + List actionsFromCache = entry.getActions(); + actionsFromCache.add(action); + actionCacheByType.clearCacheEntry(cacheKey, tenantId); + actionCacheByType.addToCache(cacheKey, new ActionCacheEntry(actionsFromCache), tenantId); + } + } } diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/exception/ActionMgtServerException.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/exception/ActionMgtServerException.java index 53dec0786128..3692b83eae40 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/exception/ActionMgtServerException.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/exception/ActionMgtServerException.java @@ -28,6 +28,11 @@ public ActionMgtServerException(String message, String errorCode) { super(message, errorCode); } + public ActionMgtServerException(String message, String description, String errorCode) { + + super(message, description, errorCode); + } + public ActionMgtServerException(String message, String errorCode, Throwable cause) { super(message, errorCode, cause); diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/Action.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/Action.java index 2ac5a22f401b..ab7d694d34fe 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/Action.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/Action.java @@ -48,7 +48,12 @@ public enum ActionTypes { "preRegistration", "PRE_REGISTRATION", "Pre Registration.", - "Configure an extension point for modifying user registration via a custom service."); + "Configure an extension point for modifying user registration via a custom service."), + AUTHENTICATION( + "authentication", + "AUTHENTICATION", + "Authentication.", + "Configure an extension point for user authentication via a custom service."); private final String pathParam; private final String actionType; diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/AuthType.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/AuthType.java deleted file mode 100644 index 9ea099ad2b12..000000000000 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/AuthType.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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 - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.identity.action.management.model; - -import org.apache.commons.collections.CollectionUtils; -import org.wso2.carbon.identity.action.management.ActionSecretProcessor; -import org.wso2.carbon.identity.action.management.constant.ActionMgtConstants; -import org.wso2.carbon.identity.action.management.exception.ActionMgtException; -import org.wso2.carbon.identity.action.management.util.ActionManagementUtil; -import org.wso2.carbon.identity.secret.mgt.core.exception.SecretManagementException; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -/** - * AuthType. - */ -public class AuthType { - - /** - * Authentication Type. - */ - public enum AuthenticationType { - - NONE("none", "NONE", Collections.emptyList()), - BEARER("bearer", "BEARER", Arrays.asList(AuthenticationProperty.ACCESS_TOKEN)), - BASIC("basic", "BASIC", - Arrays.asList(AuthenticationProperty.USERNAME, AuthenticationProperty.PASSWORD)), - API_KEY("apiKey", "API_KEY", - Arrays.asList(AuthenticationProperty.HEADER, AuthenticationProperty.VALUE)); - - private final String pathParam; - private final String type; - private final List properties; - - AuthenticationType(String pathParam, String type, List properties) { - - this.pathParam = pathParam; - this.type = type; - this.properties = properties; - } - - public String getPathParam() { - - return pathParam; - } - - public String getType() { - - return type; - } - - public List getProperties() { - - return properties; - } - - /** - * Authentication Property. - */ - public enum AuthenticationProperty { - ACCESS_TOKEN("accessToken", true), - USERNAME("username", true), - PASSWORD("password", true), - HEADER("header", false), - VALUE("value", true); - - private final String name; - private final boolean isConfidential; - - AuthenticationProperty(String name, boolean isConfidential) { - this.name = name; - this.isConfidential = isConfidential; - } - - public String getName() { - return name; - } - - public boolean getIsConfidential() { - return isConfidential; - } - } - } - - private AuthenticationType type; - private List properties = null; - private final ActionSecretProcessor secretProcessor = new ActionSecretProcessor(); - - public AuthType() { - } - - public AuthType(AuthTypeBuilder authTypeBuilder) { - - this.type = authTypeBuilder.type; - this.properties = authTypeBuilder.properties; - } - - public AuthenticationType getType() { - - return type; - } - - public List getProperties() { - - return properties; - } - - public List getPropertiesWithDecryptedValues(String actionId) throws ActionMgtException { - - try { - return CollectionUtils.isEmpty(properties) ? properties : - secretProcessor.decryptAssociatedSecrets(properties, type.getType(), actionId); - } catch (SecretManagementException e) { - throw ActionManagementUtil.handleServerException( - ActionMgtConstants.ErrorMessages.ERROR_WHILE_DECRYPTING_ACTION_ENDPOINT_AUTH_PROPERTIES, e); - } - } - - public List getPropertiesWithSecretReferences(String actionId) throws SecretManagementException { - - return CollectionUtils.isEmpty(properties) ? properties : - secretProcessor.getPropertiesWithSecretReferences(properties, actionId, type.name()); - } - - /** - * AuthType builder. - */ - public static class AuthTypeBuilder { - - private AuthenticationType type; - private List properties = null; - - public AuthTypeBuilder() { - } - - public AuthTypeBuilder type(AuthenticationType type) { - - this.type = type; - return this; - } - - public AuthTypeBuilder properties(List properties) { - - this.properties = properties; - return this; - } - - public AuthTypeBuilder addProperty(AuthProperty authProperty) { - - if (this.properties == null) { - this.properties = new ArrayList<>(); - } - this.properties.add(authProperty); - return this; - } - - public AuthType build() { - - return new AuthType(this); - } - } -} diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/Authentication.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/Authentication.java new file mode 100644 index 000000000000..5d1717a7aa71 --- /dev/null +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/Authentication.java @@ -0,0 +1,236 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.action.management.model; + +import org.apache.commons.collections.CollectionUtils; +import org.wso2.carbon.identity.action.management.ActionSecretProcessor; +import org.wso2.carbon.identity.action.management.constant.ActionMgtConstants; +import org.wso2.carbon.identity.action.management.exception.ActionMgtException; +import org.wso2.carbon.identity.action.management.util.ActionManagementUtil; +import org.wso2.carbon.identity.secret.mgt.core.exception.SecretManagementException; + +import java.util.ArrayList; +import java.util.List; + +/** + * Authentication class which hold supported authentication types and their properties. + */ +public class Authentication { + + /** + * Authentication Type. + */ + public enum Type { + + NONE("none", "NONE"), + BEARER("bearer", "BEARER"), + BASIC("basic", "BASIC"), + API_KEY("apiKey", "API_KEY"); + + private final String pathParam; + private final String name; + + Type(String pathParam, String name) { + + this.pathParam = pathParam; + this.name = name; + } + + public String getPathParam() { + + return pathParam; + } + + public String getName() { + + return name; + } + } + + /** + * Authentication Property Enum. + */ + public enum Property { + + USERNAME("username"), + PASSWORD("password"), + HEADER("header"), + VALUE("value"), + ACCESS_TOKEN("accessToken"); + + private final String name; + + Property(String name) { + + this.name = name; + } + + public String getName() { + + return name; + } + } + + private final Type type; + private List properties = null; + private final ActionSecretProcessor secretProcessor = new ActionSecretProcessor(); + + public Authentication(BasicAuthBuilder basicAuthBuilder) { + + this.type = basicAuthBuilder.type; + this.properties = basicAuthBuilder.properties; + } + + public Authentication(BearerAuthBuilder bearerAuthBuilder) { + + this.type = bearerAuthBuilder.type; + this.properties = bearerAuthBuilder.properties; + } + + public Authentication(APIKeyAuthBuilder apiKeyAuthBuilder) { + + this.type = apiKeyAuthBuilder.type; + this.properties = apiKeyAuthBuilder.properties; + } + + public Authentication(NoneAuthBuilder noneAuthBuilder) { + + this.type = noneAuthBuilder.type; + this.properties = noneAuthBuilder.properties; + } + + public Type getType() { + + return type; + } + + public List getProperties() { + + return properties; + } + + public AuthProperty getProperty(Property propertyName) { + + return this.properties.stream() + .filter(property -> propertyName.getName().equals(property.getName())) + .findFirst() + .orElse(null); + } + + public List getPropertiesWithDecryptedValues(String actionId) throws ActionMgtException { + + try { + return CollectionUtils.isEmpty(properties) ? properties : + secretProcessor.decryptAssociatedSecrets(properties, type.getName(), actionId); + } catch (SecretManagementException e) { + throw ActionManagementUtil.handleServerException( + ActionMgtConstants.ErrorMessages.ERROR_WHILE_DECRYPTING_ACTION_ENDPOINT_AUTH_PROPERTIES, e); + } + } + + public List getPropertiesWithSecretReferences(String actionId) throws SecretManagementException { + + return CollectionUtils.isEmpty(properties) ? properties : + secretProcessor.getPropertiesWithSecretReferences(properties, actionId, type.name()); + } + + /** + * Basic Authentication builder. + */ + public static class BasicAuthBuilder { + + private final Type type; + private final List properties = new ArrayList<>(); + + public BasicAuthBuilder(String username, String password) { + this.type = Type.BASIC; + this.properties.add(new AuthProperty.AuthPropertyBuilder() + .name(Property.USERNAME.getName()).value(username).isConfidential(true).build()); + this.properties.add(new AuthProperty.AuthPropertyBuilder() + .name(Property.PASSWORD.getName()).value(password).isConfidential(true).build()); + } + + public Authentication build() { + + return new Authentication(this); + } + } + + /** + * Bearer Authentication builder. + */ + public static class BearerAuthBuilder { + + private final Type type; + private final List properties = new ArrayList<>(); + + public BearerAuthBuilder(String accessToken) { + this.type = Type.BEARER; + this.properties.add(new AuthProperty.AuthPropertyBuilder() + .name(Property.ACCESS_TOKEN.getName()).value(accessToken).isConfidential(true).build()); + } + + public Authentication build() { + + return new Authentication(this); + } + } + + /** + * API Key Authentication builder. + */ + public static class APIKeyAuthBuilder { + + private final Type type; + private final List properties = new ArrayList<>(); + + public APIKeyAuthBuilder(String header, String value) { + + this.type = Type.API_KEY; + this.properties.add(new AuthProperty.AuthPropertyBuilder() + .name(Property.HEADER.getName()).value(header).isConfidential(false).build()); + this.properties.add(new AuthProperty.AuthPropertyBuilder() + .name(Property.VALUE.getName()).value(value).isConfidential(true).build()); + } + + public Authentication build() { + + return new Authentication(this); + } + } + + /** + * None Authentication builder. + */ + public static class NoneAuthBuilder { + + private final Type type; + private final List properties = new ArrayList<>(); + + public NoneAuthBuilder() { + + this.type = Type.NONE; + } + + public Authentication build() { + + return new Authentication(this); + } + } +} diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/EndpointConfig.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/EndpointConfig.java index 7b97f6587f29..a1b146334cda 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/EndpointConfig.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/main/java/org/wso2/carbon/identity/action/management/model/EndpointConfig.java @@ -24,7 +24,7 @@ public class EndpointConfig { private String uri; - private AuthType authentication; + private Authentication authentication; public EndpointConfig() { } @@ -40,7 +40,7 @@ public String getUri() { return uri; } - public AuthType getAuthentication() { + public Authentication getAuthentication() { return authentication; } @@ -51,7 +51,7 @@ public AuthType getAuthentication() { public static class EndpointConfigBuilder { private String uri; - private AuthType authentication; + private Authentication authentication; public EndpointConfigBuilder() { } @@ -62,7 +62,7 @@ public EndpointConfigBuilder uri(String uri) { return this; } - public EndpointConfigBuilder authentication(AuthType authentication) { + public EndpointConfigBuilder authentication(Authentication authentication) { this.authentication = authentication; return this; diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/java/org/wso2/carbon/identity/action/management/ActionManagementServiceImplTest.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/java/org/wso2/carbon/identity/action/management/ActionManagementServiceImplTest.java new file mode 100644 index 000000000000..5beafe9b0c00 --- /dev/null +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/java/org/wso2/carbon/identity/action/management/ActionManagementServiceImplTest.java @@ -0,0 +1,418 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.action.management; + +import org.apache.commons.dbcp.BasicDataSource; +import org.mockito.MockedStatic; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.identity.action.management.exception.ActionMgtException; +import org.wso2.carbon.identity.action.management.internal.ActionMgtServiceComponentHolder; +import org.wso2.carbon.identity.action.management.model.Action; +import org.wso2.carbon.identity.action.management.model.AuthProperty; +import org.wso2.carbon.identity.action.management.model.Authentication; +import org.wso2.carbon.identity.action.management.model.EndpointConfig; +import org.wso2.carbon.identity.common.testng.WithAxisConfiguration; +import org.wso2.carbon.identity.common.testng.WithCarbonHome; +import org.wso2.carbon.identity.common.testng.WithH2Database; +import org.wso2.carbon.identity.common.testng.WithRealmService; +import org.wso2.carbon.identity.common.testng.WithRegistry; +import org.wso2.carbon.identity.core.internal.IdentityCoreServiceDataHolder; +import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil; +import org.wso2.carbon.identity.secret.mgt.core.SecretManagerImpl; +import org.wso2.carbon.identity.secret.mgt.core.exception.SecretManagementException; +import org.wso2.carbon.identity.secret.mgt.core.model.SecretType; + +import java.nio.file.Paths; +import java.sql.Connection; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; + +/** + * This class is a test suite for the ActionManagementServiceImpl class. + * It contains unit tests to verify the functionality of the methods + * in the ActionManagementServiceImpl class. + */ +@WithAxisConfiguration +@WithCarbonHome +@WithH2Database(files = {"dbscripts/h2.sql"}) +@WithRegistry +@WithRealmService(injectToSingletons = {IdentityCoreServiceDataHolder.class}) +public class ActionManagementServiceImplTest { + + private MockedStatic identityDatabaseUtil; + private Action action; + private String tenantDomain; + private ActionManagementService serviceImpl; + private Map secretProperties; + private static final String DB_NAME = "action_mgt"; + private static final String ACCESS_TOKEN = "6e47f1f7-bd29-41e9-b5dc-e9dd70ac22b7"; + private static final Map dataSourceMap = new HashMap<>(); + private static final String PRE_ISSUE_ACCESS_TOKEN = Action.ActionTypes.PRE_ISSUE_ACCESS_TOKEN.getPathParam(); + + @BeforeClass + public void setUpClass() throws Exception { + + serviceImpl = ActionManagementServiceImpl.getInstance(); + tenantDomain = CarbonContext.getThreadLocalCarbonContext().getTenantDomain(); + initiateH2Database(getFilePath()); + } + + @BeforeMethod + public void setUp() throws SecretManagementException { + + identityDatabaseUtil = mockStatic(IdentityDatabaseUtil.class); + SecretManagerImpl secretManager = mock(SecretManagerImpl.class); + SecretType secretType = mock(SecretType.class); + ActionMgtServiceComponentHolder.getInstance().setSecretManager(secretManager); + when(secretType.getId()).thenReturn("secretId"); + when(secretManager.getSecretType(any())).thenReturn(secretType); + mockDBConnection(); + } + + @AfterMethod + public void tearDown() { + + identityDatabaseUtil.close(); + } + + @AfterClass + public void wrapUp() throws Exception { + + closeH2Database(); + } + + @Test(priority = 1) + public void testAddAction() throws ActionMgtException, SecretManagementException { + + Action creatingAction = buildMockAction( + "PreIssueAccessToken", + "To configure PreIssueAccessToken", + "https://example.com", + buildMockBasicAuthentication("admin", "admin")); + action = serviceImpl.addAction(PRE_ISSUE_ACCESS_TOKEN, creatingAction, + tenantDomain); + Assert.assertNotNull(action.getId()); + Assert.assertEquals(creatingAction.getName(), action.getName()); + Assert.assertEquals(creatingAction.getDescription(), action.getDescription()); + Assert.assertEquals(Action.Status.ACTIVE, action.getStatus()); + Assert.assertEquals(Action.ActionTypes.PRE_ISSUE_ACCESS_TOKEN.getActionType(), + action.getType().getActionType()); + Assert.assertEquals(creatingAction.getEndpoint().getUri(), action.getEndpoint().getUri()); + Assert.assertEquals(creatingAction.getEndpoint().getAuthentication().getType(), + action.getEndpoint().getAuthentication().getType()); + Assert.assertEquals(creatingAction.getEndpoint().getAuthentication().getProperties().size(), + action.getEndpoint().getAuthentication().getProperties().size()); + Assert.assertEquals(creatingAction.getEndpoint().getAuthentication().getProperties().size(), + action.getEndpoint().getAuthentication().getPropertiesWithSecretReferences(action.getId()).size()); + secretProperties = mapActionAuthPropertiesWithSecrets(action); + Assert.assertEquals( + action.getEndpoint().getAuthentication().getProperty(Authentication.Property.USERNAME).getValue(), + secretProperties.get(Authentication.Property.USERNAME.getName())); + Assert.assertEquals( + action.getEndpoint().getAuthentication().getProperty(Authentication.Property.PASSWORD).getValue(), + secretProperties.get(Authentication.Property.PASSWORD.getName())); + } + + @Test(priority = 2, expectedExceptions = ActionMgtException.class, + expectedExceptionsMessageRegExp = "Unable to create an Action.") + public void testAddMaximumActionsPerType() throws ActionMgtException { + + Action creatingAction = buildMockAction( + "PreIssueAccessToken", + "To configure PreIssueAccessToken", + "https://example.com", + buildMockBasicAuthentication("admin", "admin")); + action = serviceImpl.addAction(PRE_ISSUE_ACCESS_TOKEN, creatingAction, + tenantDomain); + } + + @Test(priority = 3) + public void testGetActionsByActionType() throws ActionMgtException, SecretManagementException { + + List actions = serviceImpl.getActionsByActionType(PRE_ISSUE_ACCESS_TOKEN, tenantDomain); + Assert.assertEquals(1, actions.size()); + for (Action result: actions) { + Assert.assertEquals(action.getId(), result.getId()); + Assert.assertEquals(action.getName(), result.getName()); + Assert.assertEquals(action.getDescription(), result.getDescription()); + Assert.assertEquals(action.getType().getActionType(), result.getType().getActionType()); + Assert.assertEquals(action.getStatus(), result.getStatus()); + Assert.assertEquals(action.getEndpoint().getUri(), result.getEndpoint().getUri()); + Assert.assertEquals(action.getEndpoint().getAuthentication().getType(), + result.getEndpoint().getAuthentication().getType()); + secretProperties = mapActionAuthPropertiesWithSecrets(result); + Assert.assertEquals( + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.USERNAME).getValue(), + secretProperties.get(Authentication.Property.USERNAME.getName())); + Assert.assertEquals( + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.PASSWORD).getValue(), + secretProperties.get(Authentication.Property.PASSWORD.getName())); + } + } + + @Test(priority = 4) + public void testGetActionByActionId() throws ActionMgtException, SecretManagementException { + + Action result = serviceImpl.getActionByActionId(action.getType().getPathParam(), action.getId(), tenantDomain); + Assert.assertEquals(action.getId(), result.getId()); + Assert.assertEquals(action.getName(), result.getName()); + Assert.assertEquals(action.getDescription(), result.getDescription()); + Assert.assertEquals(action.getType(), result.getType()); + Assert.assertEquals(action.getStatus(), result.getStatus()); + Assert.assertEquals(action.getEndpoint().getUri(), result.getEndpoint().getUri()); + Assert.assertEquals(action.getEndpoint().getAuthentication().getType(), + result.getEndpoint().getAuthentication().getType()); + secretProperties = mapActionAuthPropertiesWithSecrets(result); + Assert.assertEquals( + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.USERNAME).getValue(), + secretProperties.get(Authentication.Property.USERNAME.getName())); + Assert.assertEquals( + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.PASSWORD).getValue(), + secretProperties.get(Authentication.Property.PASSWORD.getName())); + } + + @Test(priority = 5) + public void testGetActionsByActionTypeFromCache() throws ActionMgtException, SecretManagementException { + + // Verify that the action is retrieved from the cache based on action type. + List actions = serviceImpl.getActionsByActionType( + PRE_ISSUE_ACCESS_TOKEN, tenantDomain); + Assert.assertEquals(1, actions.size()); + Action result = actions.get(0); + Assert.assertEquals(action.getId(), result.getId()); + Assert.assertEquals(action.getName(), result.getName()); + Assert.assertEquals(action.getDescription(), result.getDescription()); + Assert.assertEquals(action.getType(), result.getType()); + Assert.assertEquals(action.getStatus(), result.getStatus()); + Assert.assertEquals(action.getEndpoint().getUri(), result.getEndpoint().getUri()); + Assert.assertEquals(action.getEndpoint().getAuthentication().getType(), + result.getEndpoint().getAuthentication().getType()); + secretProperties = mapActionAuthPropertiesWithSecrets(result); + Assert.assertEquals( + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.USERNAME).getValue(), + secretProperties.get(Authentication.Property.USERNAME.getName())); + Assert.assertEquals( + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.PASSWORD).getValue(), + secretProperties.get(Authentication.Property.PASSWORD.getName())); + } + + @Test(priority = 6) + public void testUpdateAction() throws ActionMgtException, SecretManagementException { + + Action updatingAction = buildMockAction( + "Pre Issue Access Token", + "To update configuration pre issue access token", + "https://sample.com", + buildMockAPIKeyAuthentication("header", "value")); + Action result = serviceImpl.updateAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), updatingAction, tenantDomain); + Assert.assertEquals(action.getId(), result.getId()); + Assert.assertEquals(updatingAction.getName(), result.getName()); + Assert.assertEquals(updatingAction.getDescription(), result.getDescription()); + Assert.assertEquals(action.getType(), result.getType()); + Assert.assertEquals(action.getStatus(), result.getStatus()); + Assert.assertEquals(updatingAction.getEndpoint().getUri(), result.getEndpoint().getUri()); + Assert.assertEquals( + updatingAction.getEndpoint().getAuthentication().getType(), + result.getEndpoint().getAuthentication().getType()); + Assert.assertEquals( + updatingAction.getEndpoint().getAuthentication().getProperty(Authentication.Property.HEADER).getValue(), + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.HEADER).getValue()); + secretProperties = mapActionAuthPropertiesWithSecrets(result); + Assert.assertEquals( + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.VALUE).getValue(), + secretProperties.get(Authentication.Property.VALUE.getName())); + action = result; + } + + @Test(priority = 7) + public void testDeactivateAction() throws ActionMgtException { + + Assert.assertEquals(Action.Status.ACTIVE, action.getStatus()); + Action deactivatedAction = serviceImpl.deactivateAction( + PRE_ISSUE_ACCESS_TOKEN, action.getId(), tenantDomain); + Assert.assertEquals(Action.Status.INACTIVE, deactivatedAction.getStatus()); + } + + @Test(priority = 8) + public void testActivateAction() throws ActionMgtException { + + Action result = serviceImpl.activateAction( + PRE_ISSUE_ACCESS_TOKEN, action.getId(), tenantDomain); + Assert.assertEquals(Action.Status.ACTIVE, result.getStatus()); + } + + @Test(priority = 9) + public void testGetActionsCountPerType() throws ActionMgtException { + + Map actionMap = serviceImpl.getActionsCountPerType(tenantDomain); + Assert.assertNull(actionMap.get(Action.ActionTypes.PRE_UPDATE_PASSWORD.getActionType())); + Assert.assertNull(actionMap.get(Action.ActionTypes.PRE_UPDATE_PROFILE.getActionType())); + Assert.assertNull(actionMap.get(Action.ActionTypes.PRE_REGISTRATION.getActionType())); + Assert.assertNull(actionMap.get(Action.ActionTypes.AUTHENTICATION.getActionType())); + for (Map.Entry entry: actionMap.entrySet()) { + Assert.assertEquals(Action.ActionTypes.PRE_ISSUE_ACCESS_TOKEN.getActionType(), entry.getKey()); + Assert.assertEquals(1, entry.getValue().intValue()); + } + } + + @Test(priority = 10) + public void testUpdateEndpointConfigWithSameAuthenticationType() + throws ActionMgtException, SecretManagementException { + + Authentication authentication = buildMockAPIKeyAuthentication("newheader", "newvalue"); + Action result = serviceImpl.updateActionEndpointAuthentication( + PRE_ISSUE_ACCESS_TOKEN, action.getId(), authentication, tenantDomain); + Assert.assertEquals(Authentication.Type.API_KEY, result.getEndpoint().getAuthentication().getType()); + Assert.assertEquals(authentication.getProperty(Authentication.Property.HEADER).getValue(), + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.HEADER).getValue()); + secretProperties = mapActionAuthPropertiesWithSecrets(result); + Assert.assertEquals( + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.VALUE).getValue(), + secretProperties.get(Authentication.Property.VALUE.getName())); + } + + @Test(priority = 11) + public void testUpdateEndpointConfigWithDifferentAuthenticationType() + throws ActionMgtException, SecretManagementException { + + Authentication authentication = buildMockBearerAuthentication(ACCESS_TOKEN); + Action result = serviceImpl.updateActionEndpointAuthentication( + PRE_ISSUE_ACCESS_TOKEN, action.getId(), authentication, tenantDomain); + Assert.assertEquals(Authentication.Type.BEARER, result.getEndpoint().getAuthentication().getType()); + secretProperties = mapActionAuthPropertiesWithSecrets(result); + Assert.assertEquals( + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.ACCESS_TOKEN).getValue(), + secretProperties.get(Authentication.Property.ACCESS_TOKEN.getName())); + } + + @Test(priority = 12) + public void testDeleteAction() throws ActionMgtException { + + serviceImpl.deleteAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), tenantDomain); + Assert.assertNull(serviceImpl.getActionByActionId(action.getType().getPathParam(), action.getId(), + tenantDomain)); + Map actions = serviceImpl.getActionsCountPerType(tenantDomain); + Assert.assertNull(actions.get(PRE_ISSUE_ACCESS_TOKEN)); + } + + private Map mapActionAuthPropertiesWithSecrets(Action action) throws SecretManagementException { + + return action.getEndpoint().getAuthentication() + .getPropertiesWithSecretReferences(action.getId()) + .stream() + .collect(Collectors.toMap(AuthProperty::getName, AuthProperty::getValue)); + } + + private Authentication buildMockBasicAuthentication(String username, String password) { + + return new Authentication.BasicAuthBuilder(username, password).build(); + } + + private Authentication buildMockBearerAuthentication(String accessToken) { + + return new Authentication.BearerAuthBuilder(accessToken).build(); + } + + private Authentication buildMockAPIKeyAuthentication(String header, String value) { + + return new Authentication.APIKeyAuthBuilder(header, value).build(); + } + + private EndpointConfig buildMockEndpointConfig(String uri, Authentication authentication) { + + if (uri == null && authentication == null) { + return null; + } + + return new EndpointConfig.EndpointConfigBuilder() + .uri(uri) + .authentication(authentication) + .build(); + } + + private Action buildMockAction(String name, + String description, + String uri, + Authentication authentication) { + + return new Action.ActionRequestBuilder() + .name(name) + .description(description) + .endpoint(buildMockEndpointConfig(uri, authentication)) + .build(); + } + + private void mockDBConnection() { + + identityDatabaseUtil.when(() -> IdentityDatabaseUtil.getDBConnection(anyBoolean())) + .thenAnswer(invocation -> getConnection()); + } + + private Connection getConnection() throws Exception { + + if (dataSourceMap.get(DB_NAME) != null) { + return dataSourceMap.get(DB_NAME).getConnection(); + } + throw new RuntimeException("Invalid datasource."); + } + + private void initiateH2Database(String scriptPath) throws Exception { + + BasicDataSource dataSource = new BasicDataSource(); + dataSource.setDriverClassName("org.h2.Driver"); + dataSource.setUsername("username"); + dataSource.setPassword("password"); + dataSource.setUrl("jdbc:h2:mem:test" + DB_NAME); + dataSource.setTestOnBorrow(true); + dataSource.setValidationQuery("select 1"); + try (Connection connection = dataSource.getConnection()) { + connection.createStatement().executeUpdate("RUNSCRIPT FROM '" + scriptPath + "'"); + } + dataSourceMap.put(DB_NAME, dataSource); + } + + private static String getFilePath() { + + return Paths.get(System.getProperty("user.dir"), "src", "test", "resources", "dbscripts", "h2.sql") + .toString(); + } + + private static void closeH2Database() throws SQLException { + + BasicDataSource dataSource = dataSourceMap.get(DB_NAME); + if (dataSource != null) { + dataSource.close(); + } + } +} diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/java/org/wso2/carbon/identity/action/management/dao/ActionManagementDAOImplTest.java b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/java/org/wso2/carbon/identity/action/management/dao/ActionManagementDAOImplTest.java index 70a60a685c08..e4aef5013f55 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/java/org/wso2/carbon/identity/action/management/dao/ActionManagementDAOImplTest.java +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/java/org/wso2/carbon/identity/action/management/dao/ActionManagementDAOImplTest.java @@ -31,8 +31,7 @@ import org.wso2.carbon.identity.action.management.exception.ActionMgtException; import org.wso2.carbon.identity.action.management.internal.ActionMgtServiceComponentHolder; import org.wso2.carbon.identity.action.management.model.Action; -import org.wso2.carbon.identity.action.management.model.AuthProperty; -import org.wso2.carbon.identity.action.management.model.AuthType; +import org.wso2.carbon.identity.action.management.model.Authentication; import org.wso2.carbon.identity.action.management.model.EndpointConfig; import org.wso2.carbon.identity.common.testng.WithH2Database; import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil; @@ -44,9 +43,7 @@ import java.nio.file.Paths; import java.sql.Connection; import java.sql.SQLException; -import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.UUID; @@ -116,8 +113,7 @@ public void testAddAction() throws ActionMgtException { "PreIssueAccessToken", "To configure PreIssueAccessToken", "https://example.com", - AuthType.AuthenticationType.BASIC, - buildMockBasicAuthProperties("admin", "admin")); + buildMockBasicAuthentication("admin", "admin")); action = daoImpl.addAction(PRE_ISSUE_ACCESS_TOKEN, id, creatingAction, TENANT_ID); Assert.assertEquals(id, action.getId()); Assert.assertEquals(creatingAction.getName(), action.getName()); @@ -137,8 +133,7 @@ public void testAddActionWithoutName() throws ActionMgtException { null, "To configure PreIssueAccessToken", "https://example.com", - AuthType.AuthenticationType.BASIC, - buildMockBasicAuthProperties("admin", "admin")); + buildMockBasicAuthentication("admin", "admin")); this.action = daoImpl.addAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), action, TENANT_ID); } @@ -161,7 +156,7 @@ public void testGetActionsByActionType() throws ActionMgtException, SQLException @Test(priority = 4) public void testGetActionByActionId() throws ActionMgtException { - Action result = daoImpl.getActionByActionId(action.getId(), TENANT_ID); + Action result = daoImpl.getActionByActionId(PRE_ISSUE_ACCESS_TOKEN, action.getId(), TENANT_ID); Assert.assertEquals(action.getId(), result.getId()); Assert.assertEquals(action.getName(), result.getName()); Assert.assertEquals(action.getDescription(), result.getDescription()); @@ -177,7 +172,7 @@ public void testDeleteAction() throws ActionMgtException, SQLException { daoImpl.deleteAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), action, TENANT_ID); mockDBConnection(); - Assert.assertNull(daoImpl.getActionByActionId(action.getId(), TENANT_ID)); + Assert.assertNull(daoImpl.getActionByActionId(PRE_ISSUE_ACCESS_TOKEN, action.getId(), TENANT_ID)); } @Test(priority = 6) @@ -188,8 +183,7 @@ public void testAddActionWithoutDescription() throws ActionMgtException { "PreIssueAccessToken", null, "https://example.com", - AuthType.AuthenticationType.BASIC, - buildMockBasicAuthProperties("admin", "admin")); + buildMockBasicAuthentication("admin", "admin")); action = daoImpl.addAction(PRE_ISSUE_ACCESS_TOKEN, id, creatingAction, TENANT_ID); Assert.assertEquals(id, action.getId()); Assert.assertEquals(creatingAction.getName(), action.getName()); @@ -208,8 +202,7 @@ public void testUpdateAction() throws ActionMgtException { "Pre Issue Access Token", "To configure pre issue access token", "https://sample.com", - AuthType.AuthenticationType.BASIC, - buildMockBasicAuthProperties("updatingadmin", "updatingadmin")); + buildMockBasicAuthentication("updatingadmin", "updatingadmin")); Action result = daoImpl.updateAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), updatingAction, action, TENANT_ID); Assert.assertEquals(action.getId(), result.getId()); Assert.assertEquals(updatingAction.getName(), result.getName()); @@ -233,8 +226,7 @@ public void testUpdateActionWithoutNameAndDescription() throws ActionMgtExceptio null, null, "https://sample.com", - AuthType.AuthenticationType.BASIC, - buildMockBasicAuthProperties("updatingadmin", "updatingadmin")); + buildMockBasicAuthentication("updatingadmin", "updatingadmin")); Action result = daoImpl.updateAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), updatingAction, action, TENANT_ID); Assert.assertEquals(action.getId(), result.getId()); Assert.assertEquals(action.getName(), result.getName()); @@ -256,7 +248,6 @@ public void testUpdateActionWithNameAndDescription() throws ActionMgtException { "Pre Issue Access Token", "To configure pre issue access token", null, - null, null); Action result = daoImpl.updateAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), updatingAction, action, TENANT_ID); Assert.assertEquals(action.getId(), result.getId()); @@ -272,14 +263,16 @@ public void testUpdateActionWithNameAndDescription() throws ActionMgtException { @Test(priority = 10) public void testUpdateActionEndpointAuthSecretProperties() throws ActionMgtException { - AuthType authType = buildMockAuthType(AuthType.AuthenticationType.BASIC, - buildMockBasicAuthProperties("newadmin", "newadmin")); - Action result = daoImpl.updateActionEndpointAuthProperties(action.getId(), authType, TENANT_ID); - Assert.assertEquals(AuthType.AuthenticationType.BASIC, result.getEndpoint().getAuthentication().getType()); - Assert.assertEquals(action.getEndpoint().getAuthentication().getProperties().get(0).getValue(), - result.getEndpoint().getAuthentication().getProperties().get(0).getValue()); - Assert.assertEquals(action.getEndpoint().getAuthentication().getProperties().get(1).getValue(), - result.getEndpoint().getAuthentication().getProperties().get(1).getValue()); + Authentication authentication = buildMockBasicAuthentication("newadmin", "newadmin"); + Action result = daoImpl.updateActionEndpointAuthProperties(PRE_ISSUE_ACCESS_TOKEN, action.getId(), + authentication, TENANT_ID); + Assert.assertEquals(Authentication.Type.BASIC, result.getEndpoint().getAuthentication().getType()); + Assert.assertEquals( + action.getEndpoint().getAuthentication().getProperty(Authentication.Property.USERNAME).getValue(), + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.USERNAME).getValue()); + Assert.assertEquals( + action.getEndpoint().getAuthentication().getProperty(Authentication.Property.PASSWORD).getValue(), + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.PASSWORD).getValue()); } @Test(priority = 11) @@ -291,8 +284,7 @@ public void testUpdateActionWithoutEndpointUri() throws ActionMgtException { "Pre Issue Access Token", "To configure pre issue access token", null, - AuthType.AuthenticationType.BASIC, - buildMockBasicAuthProperties("updatingadmin", "updatingadmin")); + buildMockBasicAuthentication("updatingadmin", "updatingadmin")); Action result = daoImpl.updateAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), updatingAction, action, TENANT_ID); Assert.assertEquals(action.getId(), result.getId()); Assert.assertEquals(updatingAction.getName(), result.getName()); @@ -311,8 +303,7 @@ public void testUpdateActionWithAuthType() throws ActionMgtException { "Pre Issue Access Token", "To configure pre issue access token", "https://sample.com", - AuthType.AuthenticationType.BEARER, - buildMockBearerAuthProperties("57c7df90-cacc-4f56-9b0a-f14bfbff3076")); + buildMockBearerAuthentication("57c7df90-cacc-4f56-9b0a-f14bfbff3076")); Action result = daoImpl.updateAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), updatingAction, action, TENANT_ID); Assert.assertEquals(action.getId(), result.getId()); Assert.assertEquals(action.getName(), result.getName()); @@ -335,7 +326,6 @@ public void testUpdateActionWithUri() throws ActionMgtException { null, null, "https://sample.com", - null, null); Action result = daoImpl.updateAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), updatingAction, action, TENANT_ID); Assert.assertEquals(action.getId(), result.getId()); @@ -358,8 +348,7 @@ public void testUpdateActionWithAuthTypeWithoutUri() throws ActionMgtException { "Pre Issue Access Token", "To configure pre issue access token", null, - AuthType.AuthenticationType.BASIC, - buildMockBasicAuthProperties("updatingadmin", "updatingadmin")); + buildMockBasicAuthentication("updatingadmin", "updatingadmin")); Action result = daoImpl.updateAction(PRE_ISSUE_ACCESS_TOKEN, action.getId(), updatingAction, action, TENANT_ID); Assert.assertEquals(action.getId(), result.getId()); Assert.assertEquals(updatingAction.getName(), result.getName()); @@ -374,23 +363,23 @@ public void testUpdateActionWithAuthTypeWithoutUri() throws ActionMgtException { @Test(priority = 15) public void testUpdateActionEndpointAuthNonSecretProperties() throws ActionMgtException, SQLException { - AuthType authType = buildMockAuthType(AuthType.AuthenticationType.API_KEY, - buildMockAPIKeyAuthProperties("updatingheader", "updatingvalue")); Action sampleAction = buildMockAction( "Pre Issue Access Token", "To configure pre issue access token", "https://sample.com", - AuthType.AuthenticationType.API_KEY, - buildMockAPIKeyAuthProperties("header", "value")); + buildMockAPIKeyAuthentication("header", "value")); Action updatingAction = daoImpl.updateAction( PRE_ISSUE_ACCESS_TOKEN, action.getId(), sampleAction, action, TENANT_ID); mockDBConnection(); - Action result = daoImpl.updateActionEndpointAuthProperties(updatingAction.getId(), authType, TENANT_ID); - Assert.assertEquals(AuthType.AuthenticationType.API_KEY, result.getEndpoint().getAuthentication().getType()); - Assert.assertEquals(authType.getProperties().get(0).getValue(), - result.getEndpoint().getAuthentication().getProperties().get(0).getValue()); - Assert.assertEquals(updatingAction.getEndpoint().getAuthentication().getProperties().get(1).getValue(), - result.getEndpoint().getAuthentication().getProperties().get(1).getValue()); + Authentication authentication = buildMockAPIKeyAuthentication("updatingheader", "updatingvalue"); + Action result = daoImpl.updateActionEndpointAuthProperties(PRE_ISSUE_ACCESS_TOKEN, updatingAction.getId(), + authentication, TENANT_ID); + Assert.assertEquals(Authentication.Type.API_KEY, result.getEndpoint().getAuthentication().getType()); + Assert.assertEquals(authentication.getProperty(Authentication.Property.HEADER).getValue(), + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.HEADER).getValue()); + Assert.assertEquals( + updatingAction.getEndpoint().getAuthentication().getProperty(Authentication.Property.VALUE).getValue(), + result.getEndpoint().getAuthentication().getProperty(Authentication.Property.VALUE).getValue()); } @Test(priority = 16) @@ -412,14 +401,13 @@ public void testActivateAction() throws ActionMgtException { public void testUpdateActionEndpoint() throws ActionMgtException { EndpointConfig endpointConfig = buildMockEndpointConfig("https://template.com", - AuthType.AuthenticationType.BEARER, - buildMockBearerAuthProperties("c7fce95f-3f5b-4cda-8bb1-4cb7b3990f83")); + buildMockBearerAuthentication("c7fce95f-3f5b-4cda-8bb1-4cb7b3990f83")); Action result = daoImpl.updateActionEndpoint( PRE_ISSUE_ACCESS_TOKEN, action.getId(), endpointConfig, action.getEndpoint() .getAuthentication(), TENANT_ID); Assert.assertNotEquals(action.getEndpoint().getUri(), result.getEndpoint().getUri()); - Assert.assertEquals(AuthType.AuthenticationType.BEARER.getType(), - result.getEndpoint().getAuthentication().getType().getType()); + Assert.assertEquals(Authentication.Type.BEARER.getName(), + result.getEndpoint().getAuthentication().getType().getName()); } @Test(priority = 19) @@ -432,71 +420,43 @@ public void testGetActionsCountPerType() throws ActionMgtException { } } - private AuthProperty buildMockAuthProperty( - AuthType.AuthenticationType.AuthenticationProperty authenticationProperty, String value) { - - return new AuthProperty.AuthPropertyBuilder() - .name(authenticationProperty.getName()) - .value(value) - .isConfidential(authenticationProperty.getIsConfidential()) - .build(); - } - - private List buildMockBasicAuthProperties(String username, String password) { + private Authentication buildMockBasicAuthentication(String username, String password) { - return Arrays.asList( - buildMockAuthProperty(AuthType.AuthenticationType.AuthenticationProperty.USERNAME, username), - buildMockAuthProperty(AuthType.AuthenticationType.AuthenticationProperty.PASSWORD, password)); + return new Authentication.BasicAuthBuilder(username, password).build(); } - private List buildMockBearerAuthProperties(String accessToken) { + private Authentication buildMockBearerAuthentication(String accessToken) { - return Arrays.asList( - buildMockAuthProperty(AuthType.AuthenticationType.AuthenticationProperty.ACCESS_TOKEN, accessToken)); + return new Authentication.BearerAuthBuilder(accessToken).build(); } - private List buildMockAPIKeyAuthProperties(String header, String value) { + private Authentication buildMockAPIKeyAuthentication(String header, String value) { - return Arrays.asList( - buildMockAuthProperty(AuthType.AuthenticationType.AuthenticationProperty.HEADER, header), - buildMockAuthProperty(AuthType.AuthenticationType.AuthenticationProperty.VALUE, value)); + return new Authentication.APIKeyAuthBuilder(header, value).build(); } - private EndpointConfig buildMockEndpointConfig(String uri, AuthType.AuthenticationType authenticationType, - List authProperties) { + private EndpointConfig buildMockEndpointConfig(String uri, Authentication authentication) { - if (uri == null && authProperties == null) { + if (uri == null && authentication == null) { return null; } + return new EndpointConfig.EndpointConfigBuilder() .uri(uri) - .authentication(buildMockAuthType(authenticationType, authProperties)) - .build(); - } - - private AuthType buildMockAuthType(AuthType.AuthenticationType authenticationType, - List authProperties) { - - if (authenticationType == null || authProperties == null) { - return null; - } - return new AuthType.AuthTypeBuilder() - .type(authenticationType) - .properties(authProperties) + .authentication(authentication) .build(); } private Action buildMockAction(String name, String description, String uri, - AuthType.AuthenticationType authType, - List authProperties) { - - return new Action.ActionRequestBuilder() - .name(name) - .description(description) - .endpoint(buildMockEndpointConfig(uri, authType, authProperties)) - .build(); + Authentication authentication) { + + return new Action.ActionRequestBuilder() + .name(name) + .description(description) + .endpoint(buildMockEndpointConfig(uri, authentication)) + .build(); } private void mockDBConnection() throws SQLException { diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/repository.conf/carbon.xml b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/repository/conf/carbon.xml similarity index 100% rename from components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/repository.conf/carbon.xml rename to components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/repository/conf/carbon.xml diff --git a/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/testng.xml b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/testng.xml index 6a4df5584354..03794e82c90f 100644 --- a/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/testng.xml +++ b/components/action-mgt/org.wso2.carbon.identity.action.management/src/test/resources/testng.xml @@ -22,6 +22,7 @@ + diff --git a/components/action-mgt/pom.xml b/components/action-mgt/pom.xml index 51a139f499db..fb3e81a330bb 100644 --- a/components/action-mgt/pom.xml +++ b/components/action-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.collection.mgt/pom.xml b/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.collection.mgt/pom.xml index 1b050cd5e786..2f8e7f6d06c4 100644 --- a/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.collection.mgt/pom.xml +++ b/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.collection.mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework api-resource-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -123,7 +123,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-exports java.base/jdk.internal.loader=ALL-UNNAMED @@ -174,7 +176,7 @@ COMPLEXITY COVEREDRATIO - 0.90 + 0.39 diff --git a/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/pom.xml b/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/pom.xml index 35a2107b7908..178fa7948b19 100644 --- a/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/pom.xml +++ b/components/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework api-resource-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml org.wso2.carbon.identity.api.resource.mgt @@ -143,7 +143,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-exports java.base/jdk.internal.loader=ALL-UNNAMED @@ -194,7 +196,7 @@ COMPLEXITY COVEREDRATIO - 0.90 + 0.43 diff --git a/components/api-resource-mgt/pom.xml b/components/api-resource-mgt/pom.xml index 32bd862cd214..0d8c1afd7742 100644 --- a/components/api-resource-mgt/pom.xml +++ b/components/api-resource-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/application-mgt/org.wso2.carbon.identity.application.common/pom.xml b/components/application-mgt/org.wso2.carbon.identity.application.common/pom.xml index 0cbc0ab30e93..73607d170e6a 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.common/pom.xml +++ b/components/application-mgt/org.wso2.carbon.identity.application.common/pom.xml @@ -18,7 +18,7 @@ org.wso2.carbon.identity.framework application-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/pom.xml b/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/pom.xml index b655b542232a..a2bb7c082adc 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/pom.xml +++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt.ui/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.identity.framework application-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/pom.xml b/components/application-mgt/org.wso2.carbon.identity.application.mgt/pom.xml index fdfd89030e61..991f7a559a98 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/pom.xml +++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework application-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml org.wso2.carbon.identity.application.mgt @@ -273,7 +273,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED diff --git a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/listener/DefaultRoleManagementListener.java b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/listener/DefaultRoleManagementListener.java index 2f3b92a187b8..58a1976827c7 100644 --- a/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/listener/DefaultRoleManagementListener.java +++ b/components/application-mgt/org.wso2.carbon.identity.application.mgt/src/main/java/org/wso2/carbon/identity/application/mgt/listener/DefaultRoleManagementListener.java @@ -258,7 +258,7 @@ public void preDeleteRole(String roleID, String tenantDomain) clearApplicationCaches(application.getId(), tenantDomain); } } catch (IdentityRoleManagementException e) { - throw new IdentityRoleManagementException( + throw new IdentityRoleManagementException(e.getErrorCode(), String.format("Error occurred while deleting role : %s and tenant domain : %s", roleID, tenantDomain), e); } diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index 0177c7ea401b..31adf2294848 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint.util/pom.xml b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint.util/pom.xml index f1332a362d47..f0dc9e16c457 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint.util/pom.xml +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.endpoint.util/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.identity.framework authentication-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -202,7 +202,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/pom.xml b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/pom.xml index 703fb9dd09d1..a3c03474ae08 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/pom.xml +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework authentication-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -324,7 +324,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java index 88c9a095f651..054821bc69bd 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/main/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtils.java @@ -2222,20 +2222,20 @@ private static void updateCookieConfig(CookieBuilder cookieBuilder, IdentityCook cookieBuilder.setDomain(cookieConfig.getDomain()); } - if (cookieConfig.getPath() != null) { - cookieBuilder.setPath(cookieConfig.getPath()); - } else if (StringUtils.isNotBlank(path)) { + if (StringUtils.isNotBlank(path)) { cookieBuilder.setPath(path); + } else if (cookieConfig.getPath() != null) { + cookieBuilder.setPath(cookieConfig.getPath()); } if (cookieConfig.getComment() != null) { cookieBuilder.setComment(cookieConfig.getComment()); } - if (cookieConfig.getMaxAge() > 0) { - cookieBuilder.setMaxAge(cookieConfig.getMaxAge()); - } else if (age != null) { + if (age != null) { cookieBuilder.setMaxAge(age); + } else if (cookieConfig.getMaxAge() > 0) { + cookieBuilder.setMaxAge(cookieConfig.getMaxAge()); } if (cookieConfig.getVersion() > 0) { diff --git a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/test/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtilsTest.java b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/test/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtilsTest.java index 146ceed3bc31..658226db0d3f 100644 --- a/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/test/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtilsTest.java +++ b/components/authentication-framework/org.wso2.carbon.identity.application.authentication.framework/src/test/java/org/wso2/carbon/identity/application/authentication/framework/util/FrameworkUtilsTest.java @@ -663,6 +663,27 @@ public void testSetCookieWithSameSiteExistCookieConfig() { assertEquals(storedCookie.getMaxAge(), age); } + @Test + public void testSetCookieExistCookieConfigWithMaxAgeAndPath() { + + IdentityCookieConfig cookieConfig = new IdentityCookieConfig(FrameworkConstants.COMMONAUTH_COOKIE); + cookieConfig.setPath("Dummy-Path"); + cookieConfig.setMaxAge(3600); + IdentityUtil.getIdentityCookiesConfigurationHolder().put(FrameworkConstants.COMMONAUTH_COOKIE, cookieConfig); + int age = 7200; + + FrameworkUtils.setCookie(request, response, FrameworkConstants.COMMONAUTH_COOKIE, "commonAuthIdValue", age); + + verify(response, times(1)).addCookie(cookieCaptor.capture()); + List capturedCookies = cookieCaptor.getAllValues(); + Cookie storedCookie = capturedCookies.get(0); + assertEquals(storedCookie.getName(), FrameworkConstants.COMMONAUTH_COOKIE); + assertEquals(storedCookie.getPath(), "Dummy-Path"); + assertEquals(storedCookie.getMaxAge(), age); + + IdentityUtil.getIdentityCookiesConfigurationHolder().put(FrameworkConstants.COMMONAUTH_COOKIE, null); + } + @Test public void testGetCookieExistingCookie() { diff --git a/components/authentication-framework/pom.xml b/components/authentication-framework/pom.xml index ff678981b9f3..ab82692efbed 100644 --- a/components/authentication-framework/pom.xml +++ b/components/authentication-framework/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/captcha-mgt/org.wso2.carbon.captcha.mgt/pom.xml b/components/captcha-mgt/org.wso2.carbon.captcha.mgt/pom.xml index 97ebb2b27d1f..a14a08bf38ad 100644 --- a/components/captcha-mgt/org.wso2.carbon.captcha.mgt/pom.xml +++ b/components/captcha-mgt/org.wso2.carbon.captcha.mgt/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.identity.framework captcha-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -38,6 +38,11 @@ kaptcha.wso2 kaptcha + + org.testng + testng + test + @@ -84,6 +89,73 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/captcha-mgt/org.wso2.carbon.captcha.mgt/src/test/resources/testng.xml b/components/captcha-mgt/org.wso2.carbon.captcha.mgt/src/test/resources/testng.xml new file mode 100644 index 000000000000..b79a9a420346 --- /dev/null +++ b/components/captcha-mgt/org.wso2.carbon.captcha.mgt/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/captcha-mgt/pom.xml b/components/captcha-mgt/pom.xml index ca6dff21f53c..a659a07057f1 100644 --- a/components/captcha-mgt/pom.xml +++ b/components/captcha-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/carbon-authenticators/pom.xml b/components/carbon-authenticators/pom.xml index 2284f1d07f28..a73bcc027270 100644 --- a/components/carbon-authenticators/pom.xml +++ b/components/carbon-authenticators/pom.xml @@ -17,7 +17,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/pom.xml b/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/pom.xml index a0eb3839fcb1..4ed7e645017c 100644 --- a/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/pom.xml +++ b/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.identity.framework thrift-authenticator - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -65,6 +65,11 @@ org.ops4j.pax.logging pax-logging-api + + org.testng + testng + test + @@ -123,6 +128,73 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/src/test/resources/testng.xml b/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/src/test/resources/testng.xml new file mode 100644 index 000000000000..806f6dfa7d90 --- /dev/null +++ b/components/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.authenticator.thrift/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/carbon-authenticators/thrift-authenticator/pom.xml b/components/carbon-authenticators/thrift-authenticator/pom.xml index e8243598e807..20eae5484a20 100644 --- a/components/carbon-authenticators/thrift-authenticator/pom.xml +++ b/components/carbon-authenticators/thrift-authenticator/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework carbon-authenticators - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/central-logger/org.wso2.carbon.identity.central.log.mgt/pom.xml b/components/central-logger/org.wso2.carbon.identity.central.log.mgt/pom.xml index a8a9ddaf3df1..96f1770b9f84 100644 --- a/components/central-logger/org.wso2.carbon.identity.central.log.mgt/pom.xml +++ b/components/central-logger/org.wso2.carbon.identity.central.log.mgt/pom.xml @@ -21,7 +21,7 @@ central-logger org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 @@ -69,6 +69,73 @@ 8 + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin @@ -92,6 +159,11 @@ com.google.code.gson gson + + org.testng + testng + test + diff --git a/components/central-logger/org.wso2.carbon.identity.central.log.mgt/src/test/resources/testng.xml b/components/central-logger/org.wso2.carbon.identity.central.log.mgt/src/test/resources/testng.xml new file mode 100644 index 000000000000..2cfb8fb8219f --- /dev/null +++ b/components/central-logger/org.wso2.carbon.identity.central.log.mgt/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/central-logger/pom.xml b/components/central-logger/pom.xml index f44d380c06c8..8ad1738e94e4 100644 --- a/components/central-logger/pom.xml +++ b/components/central-logger/pom.xml @@ -21,7 +21,7 @@ identity-framework org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/claim-mgt/org.wso2.carbon.claim.mgt.ui/pom.xml b/components/claim-mgt/org.wso2.carbon.claim.mgt.ui/pom.xml index 30e7ed719dc4..44a6594d1259 100644 --- a/components/claim-mgt/org.wso2.carbon.claim.mgt.ui/pom.xml +++ b/components/claim-mgt/org.wso2.carbon.claim.mgt.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework claim-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/claim-mgt/org.wso2.carbon.claim.mgt/pom.xml b/components/claim-mgt/org.wso2.carbon.claim.mgt/pom.xml index a5e09ea86dd9..da468f63e5a1 100644 --- a/components/claim-mgt/org.wso2.carbon.claim.mgt/pom.xml +++ b/components/claim-mgt/org.wso2.carbon.claim.mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework claim-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -54,6 +54,11 @@ org.wso2.carbon.identity.framework org.wso2.carbon.identity.claim.metadata.mgt + + org.testng + testng + test + @@ -99,6 +104,73 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/claim-mgt/org.wso2.carbon.claim.mgt/src/test/resources/testng.xml b/components/claim-mgt/org.wso2.carbon.claim.mgt/src/test/resources/testng.xml new file mode 100644 index 000000000000..7e4e54d468d8 --- /dev/null +++ b/components/claim-mgt/org.wso2.carbon.claim.mgt/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt.ui/pom.xml b/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt.ui/pom.xml index dd936ec2c984..bda8c5aed56e 100644 --- a/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt.ui/pom.xml +++ b/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt.ui/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework claim-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt/pom.xml b/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt/pom.xml index aec02748dc4d..fafd4b04c576 100644 --- a/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt/pom.xml +++ b/components/claim-mgt/org.wso2.carbon.identity.claim.metadata.mgt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework claim-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -145,7 +145,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED diff --git a/components/claim-mgt/pom.xml b/components/claim-mgt/pom.xml index 0e4e29dde1ea..bfd6248f4f8a 100644 --- a/components/claim-mgt/pom.xml +++ b/components/claim-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/client-attestation-mgt/org.wso2.carbon.identity.client.attestation.mgt/pom.xml b/components/client-attestation-mgt/org.wso2.carbon.identity.client.attestation.mgt/pom.xml index 517e4a776fb8..556902a4705d 100644 --- a/components/client-attestation-mgt/org.wso2.carbon.identity.client.attestation.mgt/pom.xml +++ b/components/client-attestation-mgt/org.wso2.carbon.identity.client.attestation.mgt/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.identity.framework client-attestation-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -167,6 +167,73 @@ + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/client-attestation-mgt/pom.xml b/components/client-attestation-mgt/pom.xml index 8fc9127b7f68..6491a394e0f5 100644 --- a/components/client-attestation-mgt/pom.xml +++ b/components/client-attestation-mgt/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/configuration-mgt/org.wso2.carbon.identity.api.server.configuration.mgt/pom.xml b/components/configuration-mgt/org.wso2.carbon.identity.api.server.configuration.mgt/pom.xml index 096b73f599b7..7eecb37c3ea6 100644 --- a/components/configuration-mgt/org.wso2.carbon.identity.api.server.configuration.mgt/pom.xml +++ b/components/configuration-mgt/org.wso2.carbon.identity.api.server.configuration.mgt/pom.xml @@ -23,11 +23,11 @@ org.wso2.carbon.identity.framework configuration-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT org.wso2.carbon.identity.api.server.configuration.mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT jar WSO2 Carbon - Configuration Management API Identity Configuration Management API diff --git a/components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/pom.xml b/components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/pom.xml index 31b1506e0fbd..eee46cba2a01 100644 --- a/components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/pom.xml +++ b/components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.core/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework configuration-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -145,7 +145,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.xml/jdk.xml.internal=ALL-UNNAMED diff --git a/components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.endpoint/pom.xml b/components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.endpoint/pom.xml index 575dd504ffdb..c406aa076211 100644 --- a/components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.endpoint/pom.xml +++ b/components/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.endpoint/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework configuration-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/configuration-mgt/pom.xml b/components/configuration-mgt/pom.xml index d5d06d4eef0a..3ff7bb36c07e 100644 --- a/components/configuration-mgt/pom.xml +++ b/components/configuration-mgt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/consent-mgt/org.wso2.carbon.identity.consent.mgt/pom.xml b/components/consent-mgt/org.wso2.carbon.identity.consent.mgt/pom.xml index 159010b5f687..a256dc053c4c 100644 --- a/components/consent-mgt/org.wso2.carbon.identity.consent.mgt/pom.xml +++ b/components/consent-mgt/org.wso2.carbon.identity.consent.mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework consent-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -175,7 +175,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED diff --git a/components/consent-mgt/pom.xml b/components/consent-mgt/pom.xml index 54303c2a3da8..e89efb919f72 100644 --- a/components/consent-mgt/pom.xml +++ b/components/consent-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt/pom.xml b/components/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt/pom.xml index b15c7f6d44a2..86d278b690ff 100644 --- a/components/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt/pom.xml +++ b/components/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework consent-server-configs-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -86,6 +86,73 @@ + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt/src/test/resources/testing.xml b/components/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt/src/test/resources/testng.xml similarity index 100% rename from components/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt/src/test/resources/testing.xml rename to components/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt/src/test/resources/testng.xml diff --git a/components/consent-server-configs-mgt/pom.xml b/components/consent-server-configs-mgt/pom.xml index 1bfb3360dd3a..d227b22bbc06 100644 --- a/components/consent-server-configs-mgt/pom.xml +++ b/components/consent-server-configs-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/cors-mgt/org.wso2.carbon.identity.cors.mgt.core/pom.xml b/components/cors-mgt/org.wso2.carbon.identity.cors.mgt.core/pom.xml index 77fbbad4d23a..054051aab523 100644 --- a/components/cors-mgt/org.wso2.carbon.identity.cors.mgt.core/pom.xml +++ b/components/cors-mgt/org.wso2.carbon.identity.cors.mgt.core/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework cors-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -126,7 +126,9 @@ org.apache.maven.plugins maven-surefire-plugin + + ${argLine} --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED diff --git a/components/cors-mgt/pom.xml b/components/cors-mgt/pom.xml index cf55e4900bff..91488dee66ee 100644 --- a/components/cors-mgt/pom.xml +++ b/components/cors-mgt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/directory-server-manager/org.wso2.carbon.directory.server.manager.common/pom.xml b/components/directory-server-manager/org.wso2.carbon.directory.server.manager.common/pom.xml index b9958d9522fa..93a784fe62ed 100644 --- a/components/directory-server-manager/org.wso2.carbon.directory.server.manager.common/pom.xml +++ b/components/directory-server-manager/org.wso2.carbon.directory.server.manager.common/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework directory-server-manager - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -38,6 +38,11 @@ org.wso2.orbit.javax.xml.bind jaxb-api + + org.testng + testng + test + @@ -66,6 +71,73 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/directory-server-manager/org.wso2.carbon.directory.server.manager.common/src/test/resources/testng.xml b/components/directory-server-manager/org.wso2.carbon.directory.server.manager.common/src/test/resources/testng.xml new file mode 100644 index 000000000000..4c2a45dcc694 --- /dev/null +++ b/components/directory-server-manager/org.wso2.carbon.directory.server.manager.common/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/directory-server-manager/org.wso2.carbon.directory.server.manager.ui/pom.xml b/components/directory-server-manager/org.wso2.carbon.directory.server.manager.ui/pom.xml index 65c8e0a85a81..a81f818f759b 100644 --- a/components/directory-server-manager/org.wso2.carbon.directory.server.manager.ui/pom.xml +++ b/components/directory-server-manager/org.wso2.carbon.directory.server.manager.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework directory-server-manager - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/directory-server-manager/org.wso2.carbon.directory.server.manager/pom.xml b/components/directory-server-manager/org.wso2.carbon.directory.server.manager/pom.xml index 4dae33cd95e1..016aae29ba5e 100644 --- a/components/directory-server-manager/org.wso2.carbon.directory.server.manager/pom.xml +++ b/components/directory-server-manager/org.wso2.carbon.directory.server.manager/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework directory-server-manager - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -72,6 +72,11 @@ org.wso2.carbon.identity.framework org.wso2.carbon.identity.application.common + + org.testng + testng + test + @@ -137,6 +142,57 @@ true + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/directory-server-manager/org.wso2.carbon.directory.server.manager/src/test/resources/testng.xml b/components/directory-server-manager/org.wso2.carbon.directory.server.manager/src/test/resources/testng.xml new file mode 100644 index 000000000000..c9cdcd4537aa --- /dev/null +++ b/components/directory-server-manager/org.wso2.carbon.directory.server.manager/src/test/resources/testng.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + diff --git a/components/directory-server-manager/pom.xml b/components/directory-server-manager/pom.xml index 4281be2021f0..4d0e722ea0f5 100644 --- a/components/directory-server-manager/pom.xml +++ b/components/directory-server-manager/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/entitlement/org.wso2.carbon.identity.api.server.entitlement/pom.xml b/components/entitlement/org.wso2.carbon.identity.api.server.entitlement/pom.xml index 50758821a3bd..3faa9ce7afd5 100644 --- a/components/entitlement/org.wso2.carbon.identity.api.server.entitlement/pom.xml +++ b/components/entitlement/org.wso2.carbon.identity.api.server.entitlement/pom.xml @@ -23,11 +23,11 @@ org.wso2.carbon.identity.framework entitlement - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT org.wso2.carbon.identity.api.server.entitlement - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT WSO2 Carbon - Entitlement REST API jar @@ -195,6 +195,18 @@ true + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + + prepare-agent + + + + diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.common/pom.xml b/components/entitlement/org.wso2.carbon.identity.entitlement.common/pom.xml index 4c18fd1817a0..357c573b1e29 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement.common/pom.xml +++ b/components/entitlement/org.wso2.carbon.identity.entitlement.common/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework entitlement - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 @@ -79,6 +79,11 @@ org.wso2.carbon.identity.framework org.wso2.carbon.identity.core + + org.testng + testng + test + @@ -136,6 +141,73 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.common/src/test/resources/testng.xml b/components/entitlement/org.wso2.carbon.identity.entitlement.common/src/test/resources/testng.xml new file mode 100644 index 000000000000..65977e15934b --- /dev/null +++ b/components/entitlement/org.wso2.carbon.identity.entitlement.common/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml index 5c11ec284276..c7a08f47fa40 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml +++ b/components/entitlement/org.wso2.carbon.identity.entitlement.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework entitlement ../pom.xml - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT org.wso2.carbon.identity.entitlement.endpoint diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/pom.xml b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/pom.xml index e66e943bf6be..27460bb07372 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement.ui/pom.xml +++ b/components/entitlement/org.wso2.carbon.identity.entitlement.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework entitlement - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/pom.xml b/components/entitlement/org.wso2.carbon.identity.entitlement/pom.xml index 08cd3377a199..ced6c0b9a568 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement/pom.xml +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework entitlement - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -150,6 +150,16 @@ testng test + + com.h2database + h2 + test + + + org.wso2.carbon.identity.framework + org.wso2.carbon.identity.testutil + test + @@ -236,6 +246,73 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/ConfigPersistenceManager.java b/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/ConfigPersistenceManager.java index 97739ec76762..81126cf6817b 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/ConfigPersistenceManager.java +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/ConfigPersistenceManager.java @@ -52,5 +52,5 @@ default PolicyCombiningAlgorithm getGlobalPolicyAlgorithm() { * @return true if the policy combining algorithm is updated, false if the policy combining algorithm is added. * @throws EntitlementException If an error occurs. */ - boolean addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) throws EntitlementException; + void addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) throws EntitlementException; } diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/HybridConfigPersistenceManager.java b/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/HybridConfigPersistenceManager.java index aa8cde8b9d3c..cc6cf4774cf7 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/HybridConfigPersistenceManager.java +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/HybridConfigPersistenceManager.java @@ -56,16 +56,15 @@ public String getGlobalPolicyAlgorithmName() { } @Override - public boolean addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) throws EntitlementException { + public void addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) throws EntitlementException { - boolean isUpdate = jdbcConfigPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(policyCombiningAlgorithm); - if (!isUpdate) { + jdbcConfigPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(policyCombiningAlgorithm); + if (registryConfigPersistenceManager.isGlobalPolicyAlgorithmExist()) { try { registryConfigPersistenceManager.deleteGlobalPolicyAlgorithm(); } catch (EntitlementException e) { LOG.debug("Error while deleting global policy combining algorithm from registry", e); } } - return isUpdate; } } diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/JDBCConfigPersistenceManager.java b/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/JDBCConfigPersistenceManager.java index e6219c4fe2ff..cff7aa02c94a 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/JDBCConfigPersistenceManager.java +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/JDBCConfigPersistenceManager.java @@ -65,7 +65,7 @@ public String getGlobalPolicyAlgorithmName() { * @throws EntitlementException throws if fails. */ @Override - public boolean addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) throws EntitlementException { + public void addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) throws EntitlementException { int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); @@ -79,10 +79,8 @@ public boolean addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) } if (StringUtils.isBlank(algorithm)) { configDAO.insertPolicyCombiningAlgorithm(policyCombiningAlgorithm, tenantId); - return false; } else { configDAO.updatePolicyCombiningAlgorithm(policyCombiningAlgorithm, tenantId); - return true; } } } diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/RegistryConfigPersistenceManager.java b/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/RegistryConfigPersistenceManager.java index c3e313fe9d63..0884d07bceb2 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/RegistryConfigPersistenceManager.java +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/main/java/org/wso2/carbon/identity/entitlement/persistence/RegistryConfigPersistenceManager.java @@ -55,9 +55,8 @@ public RegistryConfigPersistenceManager() { * @throws EntitlementException If an error occurs. */ @Override - public boolean addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) throws EntitlementException { + public void addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) throws EntitlementException { - boolean isUpdate = false; try { Collection policyCollection; if (registry.resourceExists(POLICY_DATA_COLLECTION)) { @@ -65,16 +64,11 @@ public boolean addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) } else { policyCollection = registry.newCollection(); } - if (StringUtils.isNotBlank(policyCollection.getProperty(GLOBAL_POLICY_COMBINING_ALGORITHM))) { - isUpdate = true; - } policyCollection.setProperty(GLOBAL_POLICY_COMBINING_ALGORITHM, policyCombiningAlgorithm); registry.put(POLICY_DATA_COLLECTION, policyCollection); - } catch (RegistryException e) { throw new EntitlementException("Error while updating global policy combining algorithm in policy store", e); } - return isUpdate; } /** @@ -85,6 +79,18 @@ public boolean addOrUpdateGlobalPolicyAlgorithm(String policyCombiningAlgorithm) @Override public String getGlobalPolicyAlgorithmName() { + String algorithm = getGlobalPolicyAlgorithmValue(); + + // set default + if (algorithm == null) { + algorithm = PDPConstants.Algorithms.DENY_OVERRIDES; + } + + return algorithm; + } + + private String getGlobalPolicyAlgorithmValue() { + String algorithm = null; try { if (registry.resourceExists(POLICY_DATA_COLLECTION)) { @@ -96,12 +102,6 @@ public String getGlobalPolicyAlgorithmName() { LOG.debug(e); } } - - // set default - if (algorithm == null) { - algorithm = PDPConstants.Algorithms.DENY_OVERRIDES; - } - return algorithm; } @@ -120,4 +120,10 @@ public void deleteGlobalPolicyAlgorithm() throws EntitlementException { throw new EntitlementException("Error while deleting global policy combining algorithm in policy store", e); } } + + boolean isGlobalPolicyAlgorithmExist() { + + return getGlobalPolicyAlgorithmValue() != null; + + } } diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/ConfigPersistenceManagerTest.java b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/ConfigPersistenceManagerTest.java new file mode 100644 index 000000000000..78d0314a4175 --- /dev/null +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/ConfigPersistenceManagerTest.java @@ -0,0 +1,101 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.entitlement.persistence; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; +import org.wso2.carbon.database.utils.jdbc.NamedPreparedStatement; +import org.wso2.carbon.identity.core.util.IdentityDatabaseUtil; +import org.wso2.carbon.identity.entitlement.EntitlementException; +import org.wso2.carbon.identity.entitlement.cache.ConfigCache; + +import java.sql.Connection; +import java.sql.SQLException; + +import static org.testng.Assert.assertEquals; +import static org.wso2.carbon.identity.entitlement.PDPConstants.Algorithms.DENY_OVERRIDES; +import static org.wso2.carbon.identity.entitlement.PDPConstants.Algorithms.FIRST_APPLICABLE; +import static org.wso2.carbon.identity.entitlement.PDPConstants.Algorithms.ONLY_ONE_APPLICABLE; +import static org.wso2.carbon.identity.entitlement.PDPConstants.Algorithms.ORDERED_DENY_OVERRIDES; +import static org.wso2.carbon.identity.entitlement.PDPConstants.Algorithms.PERMIT_OVERRIDES; +import static org.wso2.carbon.identity.entitlement.PDPConstants.Algorithms.ORDERED_PERMIT_OVERRIDES; + +/** + * This is the parent test class for the Config Persistence Manager test classes. + */ +public abstract class ConfigPersistenceManagerTest { + + ConfigPersistenceManager configPersistenceManager; + + @Test + public void testGetDefaultGlobalPolicyAlgorithmName() { + + String globalPolicyAlgorithmName = configPersistenceManager.getGlobalPolicyAlgorithmName(); + assertEquals(globalPolicyAlgorithmName, DENY_OVERRIDES); + } + + @DataProvider + public Object[][] globalPolicyAlgorithmData() { + + return new Object[][]{ + {DENY_OVERRIDES}, + {PERMIT_OVERRIDES}, + {FIRST_APPLICABLE}, + {ONLY_ONE_APPLICABLE}, + {ORDERED_DENY_OVERRIDES}, + {ORDERED_PERMIT_OVERRIDES} + }; + } + + @Test(dataProvider = "globalPolicyAlgorithmData") + public void testAddGlobalPolicyAlgorithm(String policyAlgorithmName) throws Exception { + + // Add the first global policy combining algorithm. + configPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(policyAlgorithmName); + String policyAlgorithmNameFromStorage = configPersistenceManager.getGlobalPolicyAlgorithmName(); + assertEquals(policyAlgorithmNameFromStorage, policyAlgorithmName); + } + + @Test(dataProvider = "globalPolicyAlgorithmData") + public void testUpdateGlobalPolicyAlgorithm(String policyAlgorithmName) throws Exception { + + configPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(DENY_OVERRIDES); + // Update the global policy combining algorithm. + configPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(policyAlgorithmName); + + String policyAlgorithmNameFromStorage = configPersistenceManager.getGlobalPolicyAlgorithmName(); + assertEquals(policyAlgorithmNameFromStorage, policyAlgorithmName); + } + + public void deletePolicyCombiningAlgorithmInDatabase() throws EntitlementException { + + ConfigCache configCache = ConfigCache.getInstance(); + configCache.clear(-1234); + + String DELETE_POLICY_COMBINING_ALGORITHMS_SQL = "DELETE FROM IDN_XACML_CONFIG"; + try (Connection connection = IdentityDatabaseUtil.getDBConnection(false)) { + try (NamedPreparedStatement removePolicyCombiningAlgoPrepStmt = new NamedPreparedStatement(connection, + DELETE_POLICY_COMBINING_ALGORITHMS_SQL)) { + removePolicyCombiningAlgoPrepStmt.execute(); + } + } catch (SQLException e) { + throw new EntitlementException("Error while removing global policy combining algorithm in policy store", e); + } + } +} diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/HybridConfigPersistenceManagerTest.java b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/HybridConfigPersistenceManagerTest.java new file mode 100644 index 000000000000..622dc821738c --- /dev/null +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/HybridConfigPersistenceManagerTest.java @@ -0,0 +1,103 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.entitlement.persistence; + +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; +import org.wso2.carbon.identity.common.testng.WithCarbonHome; +import org.wso2.carbon.identity.common.testng.WithH2Database; +import org.wso2.carbon.identity.common.testng.WithRealmService; +import org.wso2.carbon.identity.common.testng.WithRegistry; +import org.wso2.carbon.identity.entitlement.internal.EntitlementConfigHolder; +import org.wso2.carbon.identity.entitlement.internal.EntitlementServiceComponent; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.wso2.carbon.identity.entitlement.PDPConstants.Algorithms.DENY_OVERRIDES; + +/** + * This class tests the behavior of the HybridConfigPersistenceManager class. + */ +@WithCarbonHome +@WithRegistry(injectToSingletons = {EntitlementServiceComponent.class}) +@WithRealmService(injectToSingletons = {EntitlementConfigHolder.class}, initUserStoreManager = true) +@WithH2Database(jndiName = "jdbc/WSO2IdentityDB", files = {"dbscripts/h2.sql"}) +public class HybridConfigPersistenceManagerTest extends ConfigPersistenceManagerTest { + + private JDBCConfigPersistenceManager jdbcConfigPersistenceManager; + private RegistryConfigPersistenceManager registryConfigPersistenceManager; + + @BeforeMethod + public void setUp() throws Exception { + + configPersistenceManager = new HybridConfigPersistenceManager(); + jdbcConfigPersistenceManager = new JDBCConfigPersistenceManager(); + registryConfigPersistenceManager = new RegistryConfigPersistenceManager(); + } + + @AfterMethod + public void tearDown() throws Exception { + + deletePolicyCombiningAlgorithmInDatabase(); + registryConfigPersistenceManager.deleteGlobalPolicyAlgorithm(); + } + + @Test(dataProvider = "globalPolicyAlgorithmData") + public void testGetGlobalPolicyAlgorithmNameFromRegistry(String policyAlgorithmName) throws Exception { + + // Add the global policy combining algorithm. + registryConfigPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(policyAlgorithmName); + String policyAlgorithmFromRegistry = configPersistenceManager.getGlobalPolicyAlgorithmName(); + assertEquals(policyAlgorithmFromRegistry, policyAlgorithmName); + } + + @Test(dataProvider = "globalPolicyAlgorithmData") + public void testGetGlobalPolicyAlgorithmNameFromDatabase(String policyAlgorithmName) throws Exception { + + // Add the global policy combining algorithm. + jdbcConfigPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(policyAlgorithmName); + String policyAlgorithmFromDatabase = configPersistenceManager.getGlobalPolicyAlgorithmName(); + assertEquals(policyAlgorithmFromDatabase, policyAlgorithmName); + } + + @Test(dataProvider = "globalPolicyAlgorithmData") + public void testUpdateGlobalPolicyAlgorithmInRegistry(String policyAlgorithmName) throws Exception { + + registryConfigPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(DENY_OVERRIDES); + configPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(policyAlgorithmName); + // Verify that the global policy combining algorithm value was deleted from the registry. + assertFalse(registryConfigPersistenceManager.isGlobalPolicyAlgorithmExist()); + + String policyAlgorithmFromDatabase = configPersistenceManager.getGlobalPolicyAlgorithmName(); + assertEquals(policyAlgorithmFromDatabase, policyAlgorithmName); + } + + @Test(dataProvider = "globalPolicyAlgorithmData") + public void testUpdateGlobalPolicyAlgorithmInDatabase(String policyAlgorithmName) throws Exception { + + // Add the global policy combining algorithm. + configPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(DENY_OVERRIDES); + assertFalse(registryConfigPersistenceManager.isGlobalPolicyAlgorithmExist()); + configPersistenceManager.addOrUpdateGlobalPolicyAlgorithm(policyAlgorithmName); + assertFalse(registryConfigPersistenceManager.isGlobalPolicyAlgorithmExist()); + String policyAlgorithmFromDatabase = configPersistenceManager.getGlobalPolicyAlgorithmName(); + assertEquals(policyAlgorithmFromDatabase, policyAlgorithmName); + } +} diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/JDBCConfigPersistenceManagerTest.java b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/JDBCConfigPersistenceManagerTest.java new file mode 100644 index 000000000000..c39fabb3bc46 --- /dev/null +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/JDBCConfigPersistenceManagerTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.entitlement.persistence; + +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.wso2.carbon.identity.common.testng.WithCarbonHome; +import org.wso2.carbon.identity.common.testng.WithH2Database; +import org.wso2.carbon.identity.common.testng.WithRealmService; +import org.wso2.carbon.identity.common.testng.WithRegistry; +import org.wso2.carbon.identity.entitlement.internal.EntitlementConfigHolder; + +/** + * This class tests the behavior of the JDBCConfigPersistenceManager class. + */ +@WithCarbonHome +@WithRegistry +@WithRealmService(injectToSingletons = {EntitlementConfigHolder.class}, initUserStoreManager = true) +@WithH2Database(jndiName = "jdbc/WSO2IdentityDB", files = {"dbscripts/h2.sql"}) +public class JDBCConfigPersistenceManagerTest extends ConfigPersistenceManagerTest { + + @BeforeMethod + public void setUp() { + + configPersistenceManager = new JDBCConfigPersistenceManager(); + } + + @AfterMethod + public void tearDown() throws Exception { + + deletePolicyCombiningAlgorithmInDatabase(); + } +} diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/PersistenceManagerFactoryTest.java b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/PersistenceManagerFactoryTest.java index b4ce5d71702f..13c4e5e1e924 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/PersistenceManagerFactoryTest.java +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/PersistenceManagerFactoryTest.java @@ -33,7 +33,9 @@ import java.nio.file.Paths; import java.util.Properties; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; import static org.mockito.MockitoAnnotations.initMocks; import static org.testng.Assert.assertTrue; diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/RegistryConfigPersistenceManagerTest.java b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/RegistryConfigPersistenceManagerTest.java new file mode 100644 index 000000000000..0f73bc2117c8 --- /dev/null +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/java/org/wso2/carbon/identity/entitlement/persistence/RegistryConfigPersistenceManagerTest.java @@ -0,0 +1,50 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.entitlement.persistence; + +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.wso2.carbon.identity.common.testng.WithCarbonHome; +import org.wso2.carbon.identity.common.testng.WithH2Database; +import org.wso2.carbon.identity.common.testng.WithRealmService; +import org.wso2.carbon.identity.common.testng.WithRegistry; +import org.wso2.carbon.identity.entitlement.internal.EntitlementConfigHolder; +import org.wso2.carbon.identity.entitlement.internal.EntitlementServiceComponent; + +/** + * This class tests the behavior of the RegistryConfigPersistenceManager class. + */ +@WithCarbonHome +@WithRegistry(injectToSingletons = {EntitlementServiceComponent.class}) +@WithRealmService(injectToSingletons = {EntitlementConfigHolder.class}, initUserStoreManager = true) +@WithH2Database(jndiName = "jdbc/WSO2IdentityDB", files = {"dbscripts/h2.sql"}) +public class RegistryConfigPersistenceManagerTest extends ConfigPersistenceManagerTest { + + @BeforeMethod + public void setUp() throws Exception { + + configPersistenceManager = new RegistryConfigPersistenceManager(); + } + + @AfterMethod + public void tearDown() throws Exception { + + ((RegistryConfigPersistenceManager) configPersistenceManager).deleteGlobalPolicyAlgorithm(); + } +} diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/dbscripts/h2.sql b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/dbscripts/h2.sql new file mode 100644 index 000000000000..aa0c8893b4f6 --- /dev/null +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/dbscripts/h2.sql @@ -0,0 +1,1570 @@ +CREATE TABLE IF NOT EXISTS IDN_BASE_TABLE ( + PRODUCT_NAME VARCHAR (20), + PRIMARY KEY (PRODUCT_NAME) +); + +INSERT INTO IDN_BASE_TABLE values ('WSO2 Identity Server'); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH_CONSUMER_APPS ( + ID INTEGER NOT NULL AUTO_INCREMENT, + CONSUMER_KEY VARCHAR (255), + CONSUMER_SECRET VARCHAR (2048), + USERNAME VARCHAR (255), + TENANT_ID INTEGER DEFAULT 0, + USER_DOMAIN VARCHAR(50), + APP_NAME VARCHAR (255), + OAUTH_VERSION VARCHAR (128), + CALLBACK_URL VARCHAR (2048), + GRANT_TYPES VARCHAR (1024), + PKCE_MANDATORY CHAR(1) DEFAULT '0', + PKCE_SUPPORT_PLAIN CHAR(1) DEFAULT '0', + APP_STATE VARCHAR (25) DEFAULT 'ACTIVE', + USER_ACCESS_TOKEN_EXPIRE_TIME BIGINT DEFAULT 3600, + APP_ACCESS_TOKEN_EXPIRE_TIME BIGINT DEFAULT 3600, + REFRESH_TOKEN_EXPIRE_TIME BIGINT DEFAULT 84600, + ID_TOKEN_EXPIRE_TIME BIGINT DEFAULT 3600, + CONSTRAINT CONSUMER_KEY_CONSTRAINT UNIQUE (TENANT_ID, CONSUMER_KEY), + PRIMARY KEY (ID) +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE_VALIDATORS ( + APP_ID INTEGER NOT NULL, + SCOPE_VALIDATOR VARCHAR (128) NOT NULL, + PRIMARY KEY (APP_ID,SCOPE_VALIDATOR), + FOREIGN KEY (APP_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_REQUEST_TOKEN ( + REQUEST_TOKEN VARCHAR (512), + REQUEST_TOKEN_SECRET VARCHAR (512), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR (2048), + SCOPE VARCHAR(2048), + AUTHORIZED VARCHAR (128), + OAUTH_VERIFIER VARCHAR (512), + AUTHZ_USER VARCHAR (512), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY (REQUEST_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH1A_ACCESS_TOKEN ( + ACCESS_TOKEN VARCHAR (512), + ACCESS_TOKEN_SECRET VARCHAR (512), + CONSUMER_KEY_ID INTEGER, + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR (512), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY (ACCESS_TOKEN), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN ( + TOKEN_ID VARCHAR (255), + ACCESS_TOKEN VARCHAR (2048), + REFRESH_TOKEN VARCHAR (2048), + CONSUMER_KEY_ID INTEGER, + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + USER_TYPE VARCHAR (25), + GRANT_TYPE VARCHAR (50), + TIME_CREATED TIMESTAMP DEFAULT 0, + REFRESH_TOKEN_TIME_CREATED TIMESTAMP DEFAULT 0, + VALIDITY_PERIOD BIGINT, + REFRESH_TOKEN_VALIDITY_PERIOD BIGINT, + TOKEN_SCOPE_HASH VARCHAR (32), + TOKEN_STATE VARCHAR (25) DEFAULT 'ACTIVE', + TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE', + SUBJECT_IDENTIFIER VARCHAR(255), + ACCESS_TOKEN_HASH VARCHAR (512), + REFRESH_TOKEN_HASH VARCHAR (512), + IDP_ID INTEGER DEFAULT -1 NOT NULL, + TOKEN_BINDING_REF VARCHAR (32) DEFAULT 'NONE', + CONSENTED_TOKEN VARCHAR(6), + AUTHORIZED_ORGANIZATION VARCHAR(36) DEFAULT 'NONE' NOT NULL, + PRIMARY KEY (TOKEN_ID), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE, + CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TENANT_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH, + TOKEN_STATE,TOKEN_STATE_ID,IDP_ID,TOKEN_BINDING_REF,AUTHORIZED_ORGANIZATION) +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_TOKEN_BINDING ( + TOKEN_ID VARCHAR (255), + TOKEN_BINDING_TYPE VARCHAR (32), + TOKEN_BINDING_REF VARCHAR (32), + TOKEN_BINDING_VALUE VARCHAR (1024), + TENANT_ID INTEGER DEFAULT -1, + UNIQUE (TOKEN_ID,TOKEN_BINDING_TYPE,TOKEN_BINDING_VALUE), + FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN_AUDIT ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TOKEN_ID VARCHAR (255), + ACCESS_TOKEN VARCHAR(2048), + REFRESH_TOKEN VARCHAR(2048), + CONSUMER_KEY_ID INTEGER, + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + USER_TYPE VARCHAR (25), + GRANT_TYPE VARCHAR (50), + TIME_CREATED TIMESTAMP NULL, + REFRESH_TOKEN_TIME_CREATED TIMESTAMP NULL, + VALIDITY_PERIOD BIGINT, + REFRESH_TOKEN_VALIDITY_PERIOD BIGINT, + TOKEN_SCOPE_HASH VARCHAR(32), + TOKEN_STATE VARCHAR(25), + TOKEN_STATE_ID VARCHAR (128) , + SUBJECT_IDENTIFIER VARCHAR(255), + ACCESS_TOKEN_HASH VARCHAR(512), + REFRESH_TOKEN_HASH VARCHAR(512), + INVALIDATED_TIME TIMESTAMP NULL, + IDP_ID INTEGER DEFAULT -1 NOT NULL, + PRIMARY KEY(ID) +); + + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHORIZATION_CODE ( + CODE_ID VARCHAR (255), + AUTHORIZATION_CODE VARCHAR (2048), + CONSUMER_KEY_ID INTEGER, + CALLBACK_URL VARCHAR (2048), + SCOPE VARCHAR(2048), + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + TIME_CREATED TIMESTAMP, + VALIDITY_PERIOD BIGINT, + STATE VARCHAR (25) DEFAULT 'ACTIVE', + TOKEN_ID VARCHAR(255), + SUBJECT_IDENTIFIER VARCHAR(255), + PKCE_CODE_CHALLENGE VARCHAR (255), + PKCE_CODE_CHALLENGE_METHOD VARCHAR(128), + AUTHORIZATION_CODE_HASH VARCHAR (512), + IDP_ID INTEGER DEFAULT -1 NOT NULL, + PRIMARY KEY (CODE_ID), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_AUTHZ_CODE_SCOPE( + CODE_ID VARCHAR(255), + SCOPE VARCHAR(255), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY (CODE_ID, SCOPE), + FOREIGN KEY (CODE_ID) REFERENCES IDN_OAUTH2_AUTHORIZATION_CODE (CODE_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW ( + CODE_ID VARCHAR(255), + DEVICE_CODE VARCHAR(255), + USER_CODE VARCHAR(25), + QUANTIFIER INTEGER NOT NULL DEFAULT 0, + CONSUMER_KEY_ID INTEGER, + LAST_POLL_TIME TIMESTAMP NOT NULL, + EXPIRY_TIME TIMESTAMP NOT NULL, + TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + POLL_TIME BIGINT, + STATUS VARCHAR (25) DEFAULT 'PENDING', + AUTHZ_USER VARCHAR (100), + TENANT_ID INTEGER, + USER_DOMAIN VARCHAR(50), + IDP_ID INTEGER, + SUBJECT_IDENTIFIER VARCHAR(255), + PRIMARY KEY (DEVICE_CODE), + UNIQUE (CODE_ID), + CONSTRAINT USRCDE_QNTFR_CONSTRAINT UNIQUE (USER_CODE, QUANTIFIER), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_DEVICE_FLOW_SCOPES ( + ID INTEGER NOT NULL AUTO_INCREMENT, + SCOPE_ID VARCHAR(255), + SCOPE VARCHAR(255), + PRIMARY KEY (ID), + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_DEVICE_FLOW(CODE_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN_SCOPE ( + TOKEN_ID VARCHAR (255), + TOKEN_SCOPE VARCHAR (255), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY (TOKEN_ID, TOKEN_SCOPE), + FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE ( + SCOPE_ID INTEGER NOT NULL AUTO_INCREMENT, + NAME VARCHAR(255) NOT NULL, + DISPLAY_NAME VARCHAR(255) NOT NULL, + DESCRIPTION VARCHAR(512), + TENANT_ID INTEGER NOT NULL DEFAULT -1, + SCOPE_TYPE VARCHAR(255) NOT NULL, + PRIMARY KEY (SCOPE_ID), + UNIQUE (NAME, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_SCOPE_BINDING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + SCOPE_ID INTEGER NOT NULL, + SCOPE_BINDING VARCHAR(255) NOT NULL, + BINDING_TYPE VARCHAR(255) NOT NULL, + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE(SCOPE_ID) ON DELETE CASCADE, + UNIQUE (SCOPE_ID, SCOPE_BINDING, BINDING_TYPE), + PRIMARY KEY (ID) +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_RESOURCE_SCOPE ( + RESOURCE_PATH VARCHAR(255) NOT NULL, + SCOPE_ID INTEGER NOT NULL, + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY (RESOURCE_PATH), + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE (SCOPE_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_SCIM_GROUP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + ROLE_NAME VARCHAR(255) NOT NULL, + ATTR_NAME VARCHAR(1024) NOT NULL, + ATTR_VALUE VARCHAR(1024), + AUDIENCE_REF_ID INTEGER DEFAULT -1 NOT NULL, + UNIQUE(TENANT_ID, ROLE_NAME, ATTR_NAME, AUDIENCE_REF_ID), + PRIMARY KEY (ID) +); + + + +CREATE TABLE IF NOT EXISTS IDN_OPENID_REMEMBER_ME ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + COOKIE_VALUE VARCHAR(1024), + CREATED_TIME TIMESTAMP, + PRIMARY KEY (USER_NAME, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_OPENID_USER_RPS ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT 0, + RP_URL VARCHAR(255) NOT NULL, + TRUSTED_ALWAYS VARCHAR(128) DEFAULT 'FALSE', + LAST_VISIT DATE NOT NULL, + VISIT_COUNT INTEGER DEFAULT 0, + DEFAULT_PROFILE_NAME VARCHAR(255) DEFAULT 'DEFAULT', + PRIMARY KEY (USER_NAME, TENANT_ID, RP_URL) +); + +CREATE TABLE IF NOT EXISTS IDN_OPENID_ASSOCIATIONS ( + HANDLE VARCHAR(255) NOT NULL, + ASSOC_TYPE VARCHAR(255) NOT NULL, + EXPIRE_IN TIMESTAMP NOT NULL, + MAC_KEY VARCHAR(255) NOT NULL, + ASSOC_STORE VARCHAR(128) DEFAULT 'SHARED', + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY (HANDLE) +); + +CREATE TABLE IDN_STS_STORE ( + ID INTEGER AUTO_INCREMENT, + TOKEN_ID VARCHAR(255) NOT NULL, + TOKEN_CONTENT BLOB(1024) NOT NULL, + CREATE_DATE TIMESTAMP NOT NULL, + EXPIRE_DATE TIMESTAMP NOT NULL, + STATE INTEGER DEFAULT 0, + PRIMARY KEY (ID) +); + +CREATE TABLE IDN_IDENTITY_USER_DATA ( + TENANT_ID INTEGER DEFAULT -1234, + USER_NAME VARCHAR(255) NOT NULL, + DATA_KEY VARCHAR(255) NOT NULL, + DATA_VALUE VARCHAR(2048), + PRIMARY KEY (TENANT_ID, USER_NAME, DATA_KEY) +); + +CREATE TABLE IDN_IDENTITY_META_DATA ( + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + METADATA_TYPE VARCHAR(255) NOT NULL, + METADATA VARCHAR(255) NOT NULL, + VALID VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, USER_NAME, METADATA_TYPE,METADATA) +); + +CREATE TABLE IF NOT EXISTS IDN_THRIFT_SESSION ( + SESSION_ID VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + CREATED_TIME VARCHAR(255) NOT NULL, + LAST_MODIFIED_TIME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY (SESSION_ID) +); + +CREATE TABLE IDN_AUTH_SESSION_STORE ( + SESSION_ID VARCHAR (100) NOT NULL, + SESSION_TYPE VARCHAR(100) NOT NULL, + OPERATION VARCHAR(10) NOT NULL, + SESSION_OBJECT BLOB, + TIME_CREATED BIGINT, + TENANT_ID INTEGER DEFAULT -1, + EXPIRY_TIME BIGINT, + PRIMARY KEY (SESSION_ID, SESSION_TYPE, TIME_CREATED, OPERATION) +); + + +CREATE TABLE IDN_AUTH_TEMP_SESSION_STORE ( + SESSION_ID VARCHAR (100) NOT NULL, + SESSION_TYPE VARCHAR(100) NOT NULL, + OPERATION VARCHAR(10) NOT NULL, + SESSION_OBJECT BLOB, + TIME_CREATED BIGINT, + TENANT_ID INTEGER DEFAULT -1, + EXPIRY_TIME BIGINT, + PRIMARY KEY (SESSION_ID, SESSION_TYPE, TIME_CREATED, OPERATION) +); + +CREATE TABLE IF NOT EXISTS IDN_AUTH_USER ( + USER_ID VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + DOMAIN_NAME VARCHAR(255) NOT NULL, + IDP_ID INTEGER NOT NULL, + PRIMARY KEY (USER_ID), + CONSTRAINT USER_STORE_CONSTRAINT UNIQUE (USER_NAME, TENANT_ID, DOMAIN_NAME, IDP_ID)); + +CREATE TABLE IF NOT EXISTS IDN_AUTH_USER_SESSION_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + USER_ID VARCHAR(255) NOT NULL, + SESSION_ID VARCHAR(255) NOT NULL, + CONSTRAINT USER_SESSION_STORE_CONSTRAINT UNIQUE (USER_ID, SESSION_ID), + PRIMARY KEY (ID)); + +CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_APP_INFO ( + SESSION_ID VARCHAR (100) NOT NULL, + SUBJECT VARCHAR (100) NOT NULL, + APP_ID INTEGER NOT NULL, + INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL, + PRIMARY KEY (SESSION_ID, SUBJECT, APP_ID, INBOUND_AUTH_TYPE)); + +CREATE TABLE IF NOT EXISTS IDN_AUTH_SESSION_META_DATA ( + SESSION_ID VARCHAR (100) NOT NULL, + PROPERTY_TYPE VARCHAR (100) NOT NULL, + `VALUE` VARCHAR (255) NOT NULL, + PRIMARY KEY (SESSION_ID, PROPERTY_TYPE, `VALUE`) + ); + +CREATE TABLE IF NOT EXISTS SP_APP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + APP_NAME VARCHAR (255) NOT NULL , + USER_STORE VARCHAR (255) NOT NULL, + USERNAME VARCHAR (255) NOT NULL , + DESCRIPTION VARCHAR (1024), + ROLE_CLAIM VARCHAR (512), + AUTH_TYPE VARCHAR (255) NOT NULL, + PROVISIONING_USERSTORE_DOMAIN VARCHAR (512), + IS_LOCAL_CLAIM_DIALECT CHAR(1) DEFAULT '1', + IS_SEND_LOCAL_SUBJECT_ID CHAR(1) DEFAULT '0', + IS_SEND_AUTH_LIST_OF_IDPS CHAR(1) DEFAULT '0', + IS_USE_TENANT_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + IS_USE_USER_DOMAIN_SUBJECT CHAR(1) DEFAULT '1', + ENABLE_AUTHORIZATION CHAR(1) DEFAULT '0', + SUBJECT_CLAIM_URI VARCHAR (512), + IS_SAAS_APP CHAR(1) DEFAULT '0', + IS_DUMB_MODE CHAR(1) DEFAULT '0', + UUID CHAR(36), + IMAGE_URL VARCHAR(1024), + ACCESS_URL VARCHAR(1024), + IS_DISCOVERABLE CHAR(1) DEFAULT '0', + + PRIMARY KEY (ID)); + +ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_NAME_CONSTRAINT UNIQUE(APP_NAME, TENANT_ID); +ALTER TABLE SP_APP ADD CONSTRAINT APPLICATION_UUID_CONSTRAINT UNIQUE(UUID); + +CREATE TABLE IF NOT EXISTS SP_METADATA ( + ID INTEGER AUTO_INCREMENT, + SP_ID INTEGER, + NAME VARCHAR(255) NOT NULL, + `VALUE` VARCHAR(255) NOT NULL, + DISPLAY_NAME VARCHAR(255), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY (ID), + CONSTRAINT SP_METADATA_CONSTRAINT UNIQUE (SP_ID, NAME), + FOREIGN KEY (SP_ID) REFERENCES SP_APP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS SP_INBOUND_AUTH ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + INBOUND_AUTH_KEY VARCHAR (255), + INBOUND_AUTH_TYPE VARCHAR (255) NOT NULL, + INBOUND_CONFIG_TYPE VARCHAR (255) NOT NULL, + PROP_NAME VARCHAR (255), + PROP_VALUE VARCHAR (1024) , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_INBOUND_AUTH ADD CONSTRAINT APPLICATION_ID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_AUTH_STEP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + STEP_ORDER INTEGER DEFAULT 1, + APP_ID INTEGER NOT NULL , + IS_SUBJECT_STEP CHAR(1) DEFAULT '0', + IS_ATTRIBUTE_STEP CHAR(1) DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_AUTH_STEP ADD CONSTRAINT APPLICATION_ID_CONSTRAINT_STEP FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_FEDERATED_IDP ( + ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_ID INTEGER NOT NULL, + PRIMARY KEY (ID, AUTHENTICATOR_ID)); + +ALTER TABLE SP_FEDERATED_IDP ADD CONSTRAINT STEP_ID_CONSTRAINT FOREIGN KEY (ID) REFERENCES SP_AUTH_STEP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_CLAIM_DIALECT ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + SP_DIALECT VARCHAR (512) NOT NULL, + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_CLAIM_DIALECT ADD CONSTRAINT DIALECTID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_CLAIM_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_CLAIM VARCHAR (512) NOT NULL , + SP_CLAIM VARCHAR (512) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_REQUESTED VARCHAR(128) DEFAULT '0', + IS_MANDATORY VARCHAR(128) DEFAULT '0', + DEFAULT_VALUE VARCHAR(255), + PRIMARY KEY (ID)); + +ALTER TABLE SP_CLAIM_MAPPING ADD CONSTRAINT CLAIMID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_ROLE_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_ROLE VARCHAR (255) NOT NULL , + SP_ROLE VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_ROLE_MAPPING ADD CONSTRAINT ROLEID_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_REQ_PATH_AUTHENTICATOR ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + AUTHENTICATOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + PRIMARY KEY (ID)); + +ALTER TABLE SP_REQ_PATH_AUTHENTICATOR ADD CONSTRAINT REQ_AUTH_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_PROVISIONING_CONNECTOR ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER NOT NULL, + IDP_NAME VARCHAR (255) NOT NULL , + CONNECTOR_NAME VARCHAR (255) NOT NULL , + APP_ID INTEGER NOT NULL, + IS_JIT_ENABLED CHAR(1) NOT NULL DEFAULT '0', + BLOCKING CHAR(1) NOT NULL DEFAULT '0', + RULE_ENABLED CHAR(1) NOT NULL DEFAULT '0', + PRIMARY KEY (ID)); + +ALTER TABLE SP_PROVISIONING_CONNECTOR ADD CONSTRAINT PRO_CONNECTOR_APPID_CONSTRAINT FOREIGN KEY (APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE; + +CREATE TABLE IF NOT EXISTS SP_AUTH_SCRIPT ( + ID INTEGER AUTO_INCREMENT NOT NULL, + TENANT_ID INTEGER NOT NULL, + APP_ID INTEGER NOT NULL, + TYPE VARCHAR(255) NOT NULL, + CONTENT BLOB DEFAULT NULL, + IS_ENABLED CHAR(1) NOT NULL DEFAULT '0', + PRIMARY KEY (ID)); + +CREATE TABLE SP_TEMPLATE ( + ID INTEGER AUTO_INCREMENT NOT NULL, + TENANT_ID INTEGER NOT NULL, + NAME VARCHAR(255) NOT NULL, + DESCRIPTION VARCHAR(1023), + CONTENT BLOB DEFAULT NULL, + PRIMARY KEY (ID), + CONSTRAINT SP_TEMPLATE_CONSTRAINT UNIQUE (TENANT_ID, NAME)); + +CREATE TABLE IF NOT EXISTS IDN_AUTH_WAIT_STATUS ( + ID INTEGER AUTO_INCREMENT NOT NULL, + TENANT_ID INTEGER NOT NULL, + LONG_WAIT_KEY VARCHAR(255) NOT NULL, + WAIT_STATUS CHAR(1) NOT NULL DEFAULT '1', + TIME_CREATED TIMESTAMP DEFAULT 0, + EXPIRE_TIME TIMESTAMP DEFAULT 0, + PRIMARY KEY (ID), + CONSTRAINT IDN_AUTH_WAIT_STATUS_KEY UNIQUE (LONG_WAIT_KEY)); + +CREATE TABLE IF NOT EXISTS IDP ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + NAME VARCHAR(254) NOT NULL, + IS_ENABLED CHAR(1) NOT NULL DEFAULT '1', + IS_PRIMARY CHAR(1) NOT NULL DEFAULT '0', + HOME_REALM_ID VARCHAR(254), + IMAGE MEDIUMBLOB, + CERTIFICATE BLOB, + ALIAS VARCHAR(254), + INBOUND_PROV_ENABLED CHAR(1) NOT NULL DEFAULT '0', + INBOUND_PROV_USER_STORE_ID VARCHAR(254), + USER_CLAIM_URI VARCHAR(254), + ROLE_CLAIM_URI VARCHAR(254), + DESCRIPTION VARCHAR(1024), + DEFAULT_AUTHENTICATOR_NAME VARCHAR(254), + DEFAULT_PRO_CONNECTOR_NAME VARCHAR(254), + PROVISIONING_ROLE VARCHAR(128), + IS_FEDERATION_HUB CHAR(1) NOT NULL DEFAULT '0', + IS_LOCAL_CLAIM_DIALECT CHAR(1) NOT NULL DEFAULT '0', + DISPLAY_NAME VARCHAR(255), + IMAGE_URL VARCHAR(1024), + UUID CHAR(36) NOT NULL, + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, NAME), + UNIQUE (UUID) +); + +CREATE TABLE IF NOT EXISTS IDP_ROLE ( + ID INTEGER AUTO_INCREMENT, + IDP_ID INTEGER, + TENANT_ID INTEGER, + ROLE VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, ROLE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_GROUP ( + ID INTEGER AUTO_INCREMENT NOT NULL, + IDP_ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + GROUP_NAME VARCHAR(255) NOT NULL, + UUID CHAR(36) NOT NULL, + PRIMARY KEY (ID), + UNIQUE (IDP_ID, GROUP_NAME), + UNIQUE (UUID), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_ROLE_MAPPING ( + ID INTEGER AUTO_INCREMENT, + IDP_ROLE_ID INTEGER, + TENANT_ID INTEGER, + USER_STORE_ID VARCHAR (253), + LOCAL_ROLE VARCHAR(253), + PRIMARY KEY (ID), + UNIQUE (IDP_ROLE_ID, TENANT_ID, USER_STORE_ID, LOCAL_ROLE), + FOREIGN KEY (IDP_ROLE_ID) REFERENCES IDP_ROLE(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_CLAIM ( + ID INTEGER AUTO_INCREMENT, + IDP_ID INTEGER, + TENANT_ID INTEGER, + CLAIM VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDP_ID, CLAIM), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_CLAIM_MAPPING ( + ID INTEGER AUTO_INCREMENT, + IDP_CLAIM_ID INTEGER, + TENANT_ID INTEGER, + LOCAL_CLAIM VARCHAR(253), + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (IDP_CLAIM_ID, TENANT_ID, LOCAL_CLAIM), + FOREIGN KEY (IDP_CLAIM_ID) REFERENCES IDP_CLAIM(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + NAME VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '1', + DISPLAY_NAME VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, NAME), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_METADATA ( + ID INTEGER AUTO_INCREMENT, + IDP_ID INTEGER, + NAME VARCHAR(255) NOT NULL, + `VALUE` VARCHAR(255) NOT NULL, + DISPLAY_NAME VARCHAR(255), + TENANT_ID INTEGER DEFAULT -1, + PRIMARY KEY (ID), + CONSTRAINT IDP_METADATA_CONSTRAINT UNIQUE (IDP_ID, NAME), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_AUTHENTICATOR_PROPERTY ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + AUTHENTICATOR_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2047), + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, AUTHENTICATOR_ID, PROPERTY_KEY), + FOREIGN KEY (AUTHENTICATOR_ID) REFERENCES IDP_AUTHENTICATOR(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_CONFIG ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + PROVISIONING_CONNECTOR_TYPE VARCHAR(255) NOT NULL, + IS_ENABLED CHAR (1) DEFAULT '0', + IS_BLOCKING CHAR (1) DEFAULT '0', + IS_RULES_ENABLED CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, PROVISIONING_CONNECTOR_TYPE), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_PROV_CONFIG_PROPERTY ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + PROVISIONING_CONFIG_ID INTEGER, + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2048), + PROPERTY_BLOB_VALUE BLOB, + PROPERTY_TYPE VARCHAR(32) NOT NULL, + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, PROVISIONING_CONFIG_ID, PROPERTY_KEY), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_PROVISIONING_ENTITY ( + ID INTEGER AUTO_INCREMENT, + PROVISIONING_CONFIG_ID INTEGER, + ENTITY_TYPE VARCHAR(255) NOT NULL, + ENTITY_LOCAL_USERSTORE VARCHAR(255) NOT NULL, + ENTITY_NAME VARCHAR(255) NOT NULL, + ENTITY_VALUE VARCHAR(255), + TENANT_ID INTEGER, + ENTITY_LOCAL_ID VARCHAR(255), + PRIMARY KEY (ID), + UNIQUE (ENTITY_TYPE, TENANT_ID, ENTITY_LOCAL_USERSTORE, ENTITY_NAME, PROVISIONING_CONFIG_ID), + UNIQUE (PROVISIONING_CONFIG_ID, ENTITY_TYPE, ENTITY_VALUE), + FOREIGN KEY (PROVISIONING_CONFIG_ID) REFERENCES IDP_PROVISIONING_CONFIG(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDP_LOCAL_CLAIM ( + ID INTEGER AUTO_INCREMENT, + TENANT_ID INTEGER, + IDP_ID INTEGER, + CLAIM_URI VARCHAR(255) NOT NULL, + DEFAULT_VALUE VARCHAR(255), + IS_REQUESTED VARCHAR(128) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, IDP_ID, CLAIM_URI), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE); + +CREATE TABLE IF NOT EXISTS IDN_ASSOCIATED_ID ( + ID INTEGER AUTO_INCREMENT, + IDP_USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER DEFAULT -1234, + IDP_ID INTEGER NOT NULL, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + ASSOCIATION_ID CHAR(36) NOT NULL, + PRIMARY KEY (ID), + UNIQUE(IDP_USER_ID, TENANT_ID, IDP_ID), + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_USER_ACCOUNT_ASSOCIATION ( + ASSOCIATION_KEY VARCHAR(255) NOT NULL, + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(255) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME)); + +CREATE TABLE IF NOT EXISTS FIDO_DEVICE_STORE ( + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(45) NOT NULL, + TIME_REGISTERED TIMESTAMP, + KEY_HANDLE VARCHAR(200) NOT NULL, + DEVICE_DATA VARCHAR(2048) NOT NULL, + PRIMARY KEY (TENANT_ID, DOMAIN_NAME, USER_NAME, KEY_HANDLE)); + +CREATE TABLE IF NOT EXISTS FIDO2_DEVICE_STORE ( + TENANT_ID INTEGER, + DOMAIN_NAME VARCHAR(255) NOT NULL, + USER_NAME VARCHAR(45) NOT NULL, + TIME_REGISTERED TIMESTAMP, + USER_HANDLE VARCHAR(200) NOT NULL, + CREDENTIAL_ID VARCHAR(200) NOT NULL, + PUBLIC_KEY_COSE VARCHAR(2048) NOT NULL, + SIGNATURE_COUNT BIGINT, + USER_IDENTITY VARCHAR(200) NOT NULL, + DISPLAY_NAME VARCHAR(255), + IS_USERNAMELESS_SUPPORTED CHAR(1) DEFAULT '0', + PRIMARY KEY (CREDENTIAL_ID, USER_HANDLE)); + +CREATE TABLE IF NOT EXISTS IDN_RECOVERY_FLOW_DATA ( + RECOVERY_FLOW_ID VARCHAR(255) NOT NULL, + CODE VARCHAR(255), + FAILED_ATTEMPTS INTEGER DEFAULT 0 NOT NULL, + RESEND_COUNT INTEGER DEFAULT 0 NOT NULL, + TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY(RECOVERY_FLOW_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_RECOVERY_DATA ( + USER_NAME VARCHAR(255) NOT NULL, + USER_DOMAIN VARCHAR(127) NOT NULL, + TENANT_ID INTEGER DEFAULT -1, + CODE VARCHAR(255) NOT NULL, + SCENARIO VARCHAR(255) NOT NULL, + STEP VARCHAR(127) NOT NULL, + TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + REMAINING_SETS VARCHAR(2500) DEFAULT NULL, + RECOVERY_FLOW_ID VARCHAR(255), + PRIMARY KEY(USER_NAME, USER_DOMAIN, TENANT_ID, SCENARIO,STEP), + FOREIGN KEY (RECOVERY_FLOW_ID) REFERENCES IDN_RECOVERY_FLOW_DATA(RECOVERY_FLOW_ID) ON DELETE CASCADE, + UNIQUE(CODE) +); + +CREATE TABLE IF NOT EXISTS IDN_PASSWORD_HISTORY_DATA ( + ID INTEGER NOT NULL AUTO_INCREMENT, + USER_NAME VARCHAR(255) NOT NULL, + USER_DOMAIN VARCHAR(127) NOT NULL, + TENANT_ID INTEGER DEFAULT -1, + SALT_VALUE VARCHAR(255), + HASH VARCHAR(255) NOT NULL, + TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (ID), + UNIQUE (USER_NAME,USER_DOMAIN,TENANT_ID,SALT_VALUE,HASH) +); + +CREATE TABLE IF NOT EXISTS IDN_CLAIM_DIALECT ( + ID INTEGER NOT NULL AUTO_INCREMENT, + DIALECT_URI VARCHAR (255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT DIALECT_URI_CONSTRAINT UNIQUE (DIALECT_URI, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_CLAIM ( + ID INTEGER NOT NULL AUTO_INCREMENT, + DIALECT_ID INTEGER NOT NULL, + CLAIM_URI VARCHAR (255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (DIALECT_ID) REFERENCES IDN_CLAIM_DIALECT(ID) ON DELETE CASCADE, + CONSTRAINT CLAIM_URI_CONSTRAINT UNIQUE (DIALECT_ID, CLAIM_URI, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_CLAIM_MAPPED_ATTRIBUTE ( + ID INTEGER NOT NULL AUTO_INCREMENT, + LOCAL_CLAIM_ID INTEGER, + USER_STORE_DOMAIN_NAME VARCHAR (255) NOT NULL, + ATTRIBUTE_NAME VARCHAR (255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (LOCAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE, + CONSTRAINT USER_STORE_DOMAIN_CONSTRAINT UNIQUE (LOCAL_CLAIM_ID, USER_STORE_DOMAIN_NAME, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_CLAIM_PROPERTY ( + ID INTEGER NOT NULL AUTO_INCREMENT, + LOCAL_CLAIM_ID INTEGER, + PROPERTY_NAME VARCHAR (255) NOT NULL, + PROPERTY_VALUE VARCHAR (255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (LOCAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE, + CONSTRAINT PROPERTY_NAME_CONSTRAINT UNIQUE (LOCAL_CLAIM_ID, PROPERTY_NAME, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_CLAIM_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + EXT_CLAIM_ID INTEGER NOT NULL, + MAPPED_LOCAL_CLAIM_ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (EXT_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE, + FOREIGN KEY (MAPPED_LOCAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE, + CONSTRAINT EXT_TO_LOC_MAPPING_CONSTRN UNIQUE (EXT_CLAIM_ID, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_SAML2_ASSERTION_STORE ( + ID INTEGER NOT NULL AUTO_INCREMENT, + SAML2_ID VARCHAR(255) , + SAML2_ISSUER VARCHAR(255) , + SAML2_SUBJECT VARCHAR(255) , + SAML2_SESSION_INDEX VARCHAR(255) , + SAML2_AUTHN_CONTEXT_CLASS_REF VARCHAR(255) , + SAML2_ASSERTION VARCHAR(4096) , + ASSERTION BLOB , + PRIMARY KEY (ID) +); + +CREATE TABLE IDN_SAML2_ARTIFACT_STORE ( + ID INT NOT NULL AUTO_INCREMENT, + SOURCE_ID VARCHAR(255) NOT NULL, + MESSAGE_HANDLER VARCHAR(255) NOT NULL, + AUTHN_REQ_DTO BLOB NOT NULL, + SESSION_ID VARCHAR(255) NOT NULL, + INIT_TIMESTAMP TIMESTAMP NOT NULL, + EXP_TIMESTAMP TIMESTAMP NOT NULL, + ASSERTION_ID VARCHAR(255), + PRIMARY KEY (`ID`) +); + +CREATE TABLE IF NOT EXISTS IDN_OIDC_JTI ( + JWT_ID VARCHAR(255), + TENANT_ID INTEGER NOT NULL, + EXP_TIME TIMESTAMP NOT NULL , + TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , + PRIMARY KEY (JWT_ID, TENANT_ID) +); + + +CREATE TABLE IF NOT EXISTS IDN_OIDC_PROPERTY ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TENANT_ID INTEGER, + CONSUMER_KEY VARCHAR(255) , + PROPERTY_KEY VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2047) , + PRIMARY KEY (ID), + FOREIGN KEY (TENANT_ID, CONSUMER_KEY) REFERENCES IDN_OAUTH_CONSUMER_APPS(TENANT_ID, CONSUMER_KEY) ON DELETE CASCADE +); +CREATE TABLE IF NOT EXISTS IDN_OIDC_REQ_OBJECT_REFERENCE ( + ID INTEGER NOT NULL AUTO_INCREMENT, + CONSUMER_KEY_ID INTEGER , + CODE_ID VARCHAR(255) , + TOKEN_ID VARCHAR(255) , + SESSION_DATA_KEY VARCHAR(255), + PRIMARY KEY (ID), + FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE, + FOREIGN KEY (TOKEN_ID) REFERENCES IDN_OAUTH2_ACCESS_TOKEN(TOKEN_ID) ON DELETE CASCADE, + FOREIGN KEY (CODE_ID) REFERENCES IDN_OAUTH2_AUTHORIZATION_CODE(CODE_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OIDC_REQ_OBJECT_CLAIMS ( + ID INTEGER NOT NULL AUTO_INCREMENT, + REQ_OBJECT_ID INTEGER, + CLAIM_ATTRIBUTE VARCHAR(255) , + ESSENTIAL CHAR(1) NOT NULL DEFAULT '0', + `VALUE` VARCHAR(255) , + IS_USERINFO CHAR(1) NOT NULL DEFAULT '0', + PRIMARY KEY (ID), + FOREIGN KEY (REQ_OBJECT_ID) REFERENCES IDN_OIDC_REQ_OBJECT_REFERENCE (ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OIDC_REQ_OBJ_CLAIM_VALUES ( + ID INTEGER NOT NULL AUTO_INCREMENT, + REQ_OBJECT_CLAIMS_ID INTEGER , + CLAIM_VALUES VARCHAR(255) , + PRIMARY KEY (ID), + FOREIGN KEY (REQ_OBJECT_CLAIMS_ID) REFERENCES IDN_OIDC_REQ_OBJECT_CLAIMS(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_CERTIFICATE ( + ID INTEGER NOT NULL AUTO_INCREMENT, + NAME VARCHAR(100), + CERTIFICATE_IN_PEM BLOB, + TENANT_ID INTEGER DEFAULT 0, + PRIMARY KEY(ID), + CONSTRAINT CERTIFICATE_UNIQUE_KEY UNIQUE (NAME, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_OIDC_SCOPE_CLAIM_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + SCOPE_ID INTEGER NOT NULL, + EXTERNAL_CLAIM_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (SCOPE_ID) REFERENCES IDN_OAUTH2_SCOPE(SCOPE_ID) ON DELETE CASCADE, + FOREIGN KEY (EXTERNAL_CLAIM_ID) REFERENCES IDN_CLAIM(ID) ON DELETE CASCADE, + UNIQUE (SCOPE_ID, EXTERNAL_CLAIM_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_FUNCTION_LIBRARY ( + NAME VARCHAR(255) NOT NULL, + DESCRIPTION VARCHAR(1023), + TYPE VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + DATA BLOB NOT NULL, + PRIMARY KEY (TENANT_ID,NAME) +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_CIBA_AUTH_CODE ( + AUTH_CODE_KEY CHAR (36), + AUTH_REQ_ID CHAR (36), + ISSUED_TIME TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSUMER_KEY VARCHAR(255), + LAST_POLLED_TIME TIMESTAMP NOT NULL, + POLLING_INTERVAL INTEGER, + EXPIRES_IN INTEGER, + AUTHENTICATED_USER_NAME VARCHAR(255), + USER_STORE_DOMAIN VARCHAR(100), + TENANT_ID INTEGER, + AUTH_REQ_STATUS VARCHAR (100) DEFAULT 'REQUESTED', + IDP_ID INTEGER, + UNIQUE(AUTH_REQ_ID), + PRIMARY KEY (AUTH_CODE_KEY), + FOREIGN KEY (TENANT_ID, CONSUMER_KEY) REFERENCES IDN_OAUTH_CONSUMER_APPS(TENANT_ID, CONSUMER_KEY) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_CIBA_REQUEST_SCOPES ( + ID INTEGER NOT NULL AUTO_INCREMENT, + AUTH_CODE_KEY CHAR (36), + SCOPE VARCHAR (255), + FOREIGN KEY (AUTH_CODE_KEY) REFERENCES IDN_OAUTH2_CIBA_AUTH_CODE(AUTH_CODE_KEY) ON DELETE CASCADE, + PRIMARY KEY (ID) +); + +CREATE TABLE IF NOT EXISTS IDN_FED_AUTH_SESSION_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + IDP_SESSION_ID VARCHAR(255) NOT NULL, + SESSION_ID VARCHAR(255) NOT NULL, + IDP_NAME VARCHAR(255) NOT NULL, + AUTHENTICATOR_ID VARCHAR(255), + PROTOCOL_TYPE VARCHAR(255), + TIME_CREATED TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + TENANT_ID INTEGER NOT NULL DEFAULT 0, + IDP_ID INTEGER NOT NULL DEFAULT 0, + FOREIGN KEY (IDP_ID) REFERENCES IDP(ID) ON DELETE CASCADE, + PRIMARY KEY (ID), + UNIQUE (IDP_SESSION_ID, TENANT_ID, IDP_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_CONFIG_TYPE ( + ID VARCHAR(255) NOT NULL, + NAME VARCHAR(255) NOT NULL, + DESCRIPTION VARCHAR(1023) NULL, + PRIMARY KEY (ID), + CONSTRAINT TYPE_NAME_CONSTRAINT UNIQUE (NAME) +); + +INSERT INTO IDN_CONFIG_TYPE (ID, NAME, DESCRIPTION) VALUES +('9ab0ef95-13e9-4ed5-afaf-d29bed62f7bd', 'IDP_TEMPLATE', 'Template type to uniquely identify IDP templates'), +('3c4ac3d0-5903-4e3d-aaca-38df65b33bfd', 'APPLICATION_TEMPLATE', 'Template type to uniquely identify Application templates'), +('8ec6dbf1-218a-49bf-bc34-0d2db52d151c', 'CORS_CONFIGURATION', 'A resource type to keep the tenant CORS configurations'), +('669b99ca-cdb0-44a6-8cae-babed3b585df', 'Publisher', 'A resource type to keep the event publisher configurations'), +('73f6d9ca-62f4-4566-bab9-2a930ae51ba8', 'BRANDING_PREFERENCES', 'A resource type to keep the tenant branding preferences'), +('8469a176-3e6c-438a-ba01-71e9077072fa', 'APPLICATION_BRANDING_PREFERENCES', 'A resource type to keep the application branding preferences'), +('899c69b2-8bf7-46b5-9666-f7f99f90d6cc', 'fido-config', 'A resource type to store FIDO authenticator related preferences'), +('7f24050f-3e3d-4a00-b10f-fd5450d6523e', 'input-validation-configurations', 'A resource type to store input validation related configurations'), +('f4e83b8a-d1c4-a0d6-03a7-d48e268c60c5', 'PK_JWT_CONFIGURATION', 'A resource type to keep the tenant private key jwt configuration.'), +('9ec61e9d-f0e6-4952-9a09-ab842aeb2db2', 'ATTRIBUTE_CONFIGURATION', 'A resource type to store attribute related configurations.'), +('132b0ee6-43e0-462d-8b4b-15b68109d71d', 'ORGANIZATION_CONFIGURATION', 'A resource type to keep the organization configurations.'), +('1fc809a0-dc0d-4cb2-82f3-58934d389236', 'CUSTOM_TEXT', 'A resource type to keep the tenant custom text preferences.'), +('c385a42a-5697-4604-b49a-62456621e926', 'DCR_CONFIGURATION', 'A resource type to keep the DCR configurations.'); + +CREATE TABLE IF NOT EXISTS IDN_CONFIG_RESOURCE ( + ID VARCHAR(255) NOT NULL, + TENANT_ID INT NOT NULL, + NAME VARCHAR(255) NOT NULL, + CREATED_TIME TIMESTAMP NOT NULL, + LAST_MODIFIED TIMESTAMP NOT NULL, + HAS_FILE BOOLEAN NOT NULL, + HAS_ATTRIBUTE BOOLEAN NOT NULL, + TYPE_ID VARCHAR(255) NOT NULL, + UNIQUE (NAME, TENANT_ID, TYPE_ID), + PRIMARY KEY (ID) +); +ALTER TABLE IDN_CONFIG_RESOURCE +ADD CONSTRAINT TYPE_ID_FOREIGN_CONSTRAINT FOREIGN KEY (TYPE_ID) REFERENCES IDN_CONFIG_TYPE (ID) +ON DELETE CASCADE ON UPDATE CASCADE; + +CREATE TABLE IF NOT EXISTS IDN_CONFIG_ATTRIBUTE ( + ID VARCHAR(255) NOT NULL, + RESOURCE_ID VARCHAR(255) NOT NULL, + ATTR_KEY VARCHAR(255) NOT NULL, + ATTR_VALUE VARCHAR(1023) NULL, + PRIMARY KEY (ID), + UNIQUE (RESOURCE_ID, ATTR_KEY) +); +ALTER TABLE IDN_CONFIG_ATTRIBUTE +ADD CONSTRAINT RESOURCE_ID_ATTRIBUTE_FOREIGN_CONSTRAINT FOREIGN KEY (RESOURCE_ID) REFERENCES +IDN_CONFIG_RESOURCE (ID) ON DELETE CASCADE ON UPDATE CASCADE; + +CREATE TABLE IF NOT EXISTS IDN_CONFIG_FILE ( + ID VARCHAR(255) NOT NULL, + `VALUE` BLOB NULL, + RESOURCE_ID VARCHAR(255) NOT NULL, + NAME VARCHAR(255) NULL, + PRIMARY KEY (ID) +); +ALTER TABLE IDN_CONFIG_FILE +ADD CONSTRAINT RESOURCE_ID_FILE_FOREIGN_CONSTRAINT FOREIGN KEY (RESOURCE_ID) REFERENCES +IDN_CONFIG_RESOURCE (ID) ON DELETE CASCADE ON UPDATE CASCADE; + +CREATE TABLE IF NOT EXISTS IDN_REMOTE_FETCH_CONFIG ( + ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + IS_ENABLED CHAR(1) NOT NULL, + REPO_MANAGER_TYPE VARCHAR(255) NOT NULL, + ACTION_LISTENER_TYPE VARCHAR(255) NOT NULL, + CONFIG_DEPLOYER_TYPE VARCHAR(255) NOT NULL, + REMOTE_FETCH_NAME VARCHAR(255), + REMOTE_RESOURCE_URI VARCHAR(255) NOT NULL, + ATTRIBUTES_JSON MEDIUMTEXT NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT UC_REMOTE_RESOURCE_TYPE UNIQUE (TENANT_ID, CONFIG_DEPLOYER_TYPE) +); + +CREATE TABLE IF NOT EXISTS IDN_REMOTE_FETCH_REVISIONS ( + ID VARCHAR(255) NOT NULL, + CONFIG_ID VARCHAR(255) NOT NULL, + FILE_PATH VARCHAR(255) NOT NULL, + FILE_HASH VARCHAR(255), + DEPLOYED_DATE TIMESTAMP, + LAST_SYNC_TIME TIMESTAMP, + DEPLOYMENT_STATUS VARCHAR(255), + ITEM_NAME VARCHAR(255), + DEPLOY_ERR_LOG MEDIUMTEXT, + PRIMARY KEY (ID), + FOREIGN KEY (CONFIG_ID) REFERENCES IDN_REMOTE_FETCH_CONFIG(ID) ON DELETE CASCADE, + CONSTRAINT UC_REVISIONS UNIQUE (CONFIG_ID, ITEM_NAME) +); + + +CREATE TABLE IF NOT EXISTS IDN_USER_FUNCTIONALITY_MAPPING ( + ID VARCHAR(255) NOT NULL, + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + FUNCTIONALITY_ID VARCHAR(255) NOT NULL, + IS_FUNCTIONALITY_LOCKED BOOLEAN NOT NULL, + FUNCTIONALITY_UNLOCK_TIME BIGINT NOT NULL, + FUNCTIONALITY_LOCK_REASON VARCHAR(1023), + FUNCTIONALITY_LOCK_REASON_CODE VARCHAR(255), + PRIMARY KEY (ID), + CONSTRAINT IDN_USER_FUNCTIONALITY_MAPPING_CONSTRAINT UNIQUE (USER_ID, TENANT_ID, FUNCTIONALITY_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_USER_FUNCTIONALITY_PROPERTY ( + ID VARCHAR(255) NOT NULL, + USER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + FUNCTIONALITY_ID VARCHAR(255) NOT NULL, + PROPERTY_NAME VARCHAR(255), + PROPERTY_VALUE VARCHAR(255), + PRIMARY KEY (ID), + CONSTRAINT IDN_USER_FUNCTIONALITY_PROPERTY_CONSTRAINT UNIQUE (USER_ID, TENANT_ID, FUNCTIONALITY_ID, PROPERTY_NAME) +); + +CREATE TABLE IF NOT EXISTS IDN_CORS_ORIGIN ( + ID INT NOT NULL AUTO_INCREMENT, + TENANT_ID INT NOT NULL, + ORIGIN VARCHAR(2048) NOT NULL, + UUID CHAR(36) NOT NULL, + + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, ORIGIN), + UNIQUE (UUID) +); + +CREATE TABLE IF NOT EXISTS IDN_CORS_ASSOCIATION ( + IDN_CORS_ORIGIN_ID INT NOT NULL, + SP_APP_ID INT NOT NULL, + + PRIMARY KEY (IDN_CORS_ORIGIN_ID, SP_APP_ID), + FOREIGN KEY (IDN_CORS_ORIGIN_ID) REFERENCES IDN_CORS_ORIGIN (ID) ON DELETE CASCADE, + FOREIGN KEY (SP_APP_ID) REFERENCES SP_APP (ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_USER_CONSENT ( + ID INTEGER NOT NULL AUTO_INCREMENT, + USER_ID VARCHAR(255) NOT NULL, + APP_ID CHAR(36) NOT NULL, + TENANT_ID INTEGER NOT NULL DEFAULT -1, + CONSENT_ID VARCHAR(255) NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (APP_ID) REFERENCES SP_APP(UUID) ON DELETE CASCADE, + UNIQUE (USER_ID, APP_ID, TENANT_ID), + UNIQUE (CONSENT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH2_USER_CONSENTED_SCOPES ( + ID INTEGER NOT NULL AUTO_INCREMENT, + CONSENT_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL DEFAULT -1, + SCOPE VARCHAR(255) NOT NULL, + CONSENT BOOLEAN NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (CONSENT_ID) REFERENCES IDN_OAUTH2_USER_CONSENT(CONSENT_ID) ON DELETE CASCADE, + UNIQUE (CONSENT_ID, SCOPE) +); + +CREATE TABLE IF NOT EXISTS IDN_SECRET_TYPE ( + ID VARCHAR(255) NOT NULL, + NAME VARCHAR(255) NOT NULL, + DESCRIPTION VARCHAR(1023) NULL, + PRIMARY KEY (ID), + CONSTRAINT SECRET_TYPE_NAME_CONSTRAINT UNIQUE (NAME) +); + +INSERT INTO IDN_SECRET_TYPE (ID, NAME, DESCRIPTION) VALUES +('1358bdbf-e0cc-4268-a42c-c3e0960e13f0', 'ADAPTIVE_AUTH_CALL_CHOREO', 'Secret type to uniquely identify secrets relevant to callChoreo adaptive auth function'), +('c508ca28-60c0-4493-a758-77e4173ffdb9', 'IDP_SECRET_PROPERTIES', 'Secret type to uniquely identify secrets relevant to identity providers'), +('433df096-62b7-4a36-b3eb-1bed9150ed35', 'IDVP_SECRET_PROPERTIES', 'Secret type to uniquely identify secrets relevant to identity verification providers'), +('29d0c37d-139a-4b1e-a343-7b8d26f0a2a9', 'ANDROID_ATTESTATION_CREDENTIALS', 'Secret type to uniquely identify secrets relevant to android client attestation credentials'); + +CREATE TABLE IF NOT EXISTS IDN_SECRET ( + ID VARCHAR(255) NOT NULL, + TENANT_ID INT NOT NULL, + SECRET_NAME VARCHAR(1023) NOT NULL, + SECRET_VALUE VARCHAR(8000) NOT NULL, + CREATED_TIME TIMESTAMP NOT NULL, + LAST_MODIFIED TIMESTAMP NOT NULL, + TYPE_ID VARCHAR(255) NOT NULL, + DESCRIPTION VARCHAR(1023) NULL, + KEY_ID VARCHAR(255) NULL, + PRIMARY KEY (ID), + FOREIGN KEY (TYPE_ID) REFERENCES IDN_SECRET_TYPE(ID) ON DELETE CASCADE, + UNIQUE (SECRET_NAME, TENANT_ID, TYPE_ID) +); + +CREATE TABLE IF NOT EXISTS SP_SHARED_APP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + MAIN_APP_ID CHAR(36) NOT NULL, + OWNER_ORG_ID CHAR(36) NOT NULL, + SHARED_APP_ID CHAR(36) NOT NULL, + SHARED_ORG_ID CHAR(36) NOT NULL, + SHARE_WITH_ALL_CHILDREN BOOLEAN DEFAULT FALSE, + PRIMARY KEY (ID), + FOREIGN KEY (MAIN_APP_ID) REFERENCES SP_APP(UUID) ON DELETE CASCADE, + FOREIGN KEY (SHARED_APP_ID) REFERENCES SP_APP(UUID) ON DELETE CASCADE, + UNIQUE (MAIN_APP_ID, OWNER_ORG_ID, SHARED_ORG_ID), + UNIQUE (SHARED_APP_ID) +); + +CREATE TABLE IF NOT EXISTS IDVP ( + ID INTEGER NOT NULL AUTO_INCREMENT, + UUID CHAR(36) NOT NULL, + TENANT_ID INTEGER NOT NULL, + IDVP_TYPE VARCHAR(254), + NAME VARCHAR(254), + DESCRIPTION VARCHAR(1024), + IS_ENABLED CHAR(1) NOT NULL DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (TENANT_ID, NAME), + UNIQUE (UUID) +); + +CREATE TABLE IF NOT EXISTS IDVP_CLAIM_MAPPING ( + ID INTEGER NOT NULL AUTO_INCREMENT, + IDVP_ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + CLAIM VARCHAR(254), + LOCAL_CLAIM VARCHAR(254), + PRIMARY KEY (ID), + UNIQUE (IDVP_ID, CLAIM, TENANT_ID), + FOREIGN KEY (IDVP_ID) REFERENCES IDVP(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDVP_CONFIG ( + ID INTEGER NOT NULL AUTO_INCREMENT, + IDVP_ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + PROPERTY_KEY VARCHAR(254) NOT NULL, + PROPERTY_VALUE VARCHAR(1024), + IS_SECRET CHAR (1) DEFAULT '0', + PRIMARY KEY (ID), + UNIQUE (IDVP_ID, PROPERTY_KEY, TENANT_ID), + FOREIGN KEY (IDVP_ID) REFERENCES IDVP(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDV_CLAIM ( + ID INTEGER NOT NULL AUTO_INCREMENT, + UUID CHAR(36) NOT NULL, + USER_ID VARCHAR(254) NOT NULL, + CLAIM_URI VARCHAR(254), + IDVP_ID CHAR(36) NOT NULL, + TENANT_ID INTEGER NOT NULL, + IS_VERIFIED CHAR(1) NOT NULL DEFAULT '0', + METADATA BLOB, + PRIMARY KEY (ID), + UNIQUE (CLAIM_URI, TENANT_ID, USER_ID, IDVP_ID), + UNIQUE (UUID), + FOREIGN KEY (IDVP_ID) REFERENCES IDVP(UUID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_OAUTH_PAR ( + REQ_URI_REF VARCHAR(255) PRIMARY KEY, + CLIENT_ID VARCHAR(255) NOT NULL, + SCHEDULED_EXPIRY BIGINT NOT NULL, + PARAMETERS MEDIUMTEXT +); + +CREATE TABLE IF NOT EXISTS IDN_ORG_USER_INVITATION ( + ID INTEGER NOT NULL AUTO_INCREMENT, + INVITATION_ID VARCHAR(40) NOT NULL, + CONFIRMATION_CODE VARCHAR(40) NOT NULL, + USER_NAME VARCHAR(254) NOT NULL, + DOMAIN_NAME VARCHAR(254) NOT NULL, + EMAIL VARCHAR(254) NOT NULL, + USER_ORG_ID VARCHAR(254) NOT NULL, + INVITED_ORG_ID VARCHAR(254) NOT NULL, + USER_REDIRECT_URL VARCHAR(1024) NOT NULL, + STATUS VARCHAR(10) NOT NULL, + CREATED_AT TIMESTAMP NOT NULL, + EXPIRED_AT TIMESTAMP NOT NULL, + PRIMARY KEY (INVITATION_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_ORG_USER_INVITE_ASSIGNMENT( + ID INTEGER NOT NULL AUTO_INCREMENT, + INVITATION_ID VARCHAR(40) NOT NULL, + ASSIGNMENT_ID VARCHAR(255) NOT NULL, + ASSIGNMENT_TYPE VARCHAR(255) NOT NULL, + PRIMARY KEY (INVITATION_ID, ASSIGNMENT_ID, ASSIGNMENT_TYPE), + FOREIGN KEY (INVITATION_ID) REFERENCES IDN_ORG_USER_INVITATION(INVITATION_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS API_RESOURCE ( + ID CHAR(36) NOT NULL PRIMARY KEY, + CURSOR_KEY INTEGER NOT NULL AUTO_INCREMENT, + NAME VARCHAR(255) NOT NULL, + IDENTIFIER VARCHAR(255) NOT NULL, + TENANT_ID INT, + DESCRIPTION VARCHAR(255), + TYPE VARCHAR(255) NOT NULL, + REQUIRES_AUTHORIZATION BOOLEAN NOT NULL +); + +CREATE TABLE IF NOT EXISTS API_RESOURCE_PROPERTY ( + ID INTEGER AUTO_INCREMENT, + API_ID CHAR(36) NOT NULL, + NAME VARCHAR(255) NOT NULL, + `VALUE` VARCHAR(255) NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT API_RESOURCE_PROPERTY_CONSTRAINT UNIQUE (API_ID, NAME), + FOREIGN KEY (API_ID) REFERENCES API_RESOURCE(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS SCOPE ( + ID CHAR(36) NOT NULL PRIMARY KEY, + CURSOR_KEY INTEGER NOT NULL AUTO_INCREMENT, + API_ID CHAR(36) NOT NULL, + NAME VARCHAR(255) NOT NULL, + DISPLAY_NAME VARCHAR(255) NOT NULL, + TENANT_ID INT, + DESCRIPTION VARCHAR(300), + FOREIGN KEY (API_ID) REFERENCES API_RESOURCE(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS APP_ROLE_ASSOCIATION ( + APP_ID CHAR(36) NOT NULL, + ROLE_ID VARCHAR(255) NOT NULL, + PRIMARY KEY (APP_ID, ROLE_ID), + FOREIGN KEY (APP_ID) REFERENCES SP_APP(UUID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS ROLE_SCOPE ( + ROLE_ID VARCHAR(255) NOT NULL, + SCOPE_ID CHAR(36) NOT NULL, + PRIMARY KEY (ROLE_ID, SCOPE_ID), + FOREIGN KEY (SCOPE_ID) REFERENCES SCOPE(ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS AUTHORIZED_API( + APP_ID CHAR(36) NOT NULL, + API_ID CHAR(36) NOT NULL, + POLICY_ID VARCHAR(255) NOT NULL, + CONSTRAINT PK_APP_API PRIMARY KEY (APP_ID, API_ID), + FOREIGN KEY (API_ID) REFERENCES API_RESOURCE(ID) ON DELETE CASCADE, + FOREIGN KEY (APP_ID) REFERENCES SP_APP(UUID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS AUTHORIZED_SCOPE( + APP_ID CHAR(36) NOT NULL, + API_ID CHAR(36) NOT NULL, + SCOPE_ID CHAR(36) NOT NULL, + CONSTRAINT PK_APP_API_SCOPE PRIMARY KEY (APP_ID, API_ID, SCOPE_ID), + FOREIGN KEY (API_ID) REFERENCES API_RESOURCE(ID), + FOREIGN KEY (SCOPE_ID) REFERENCES SCOPE(ID) ON DELETE CASCADE, + FOREIGN KEY (APP_ID) REFERENCES SP_APP(UUID), + FOREIGN KEY (APP_ID, API_ID) REFERENCES AUTHORIZED_API(APP_ID, API_ID) ON DELETE CASCADE, + CONSTRAINT AUTHORIZED_SCOPE_UNIQUE UNIQUE (APP_ID, SCOPE_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_TYPE ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TYPE_KEY VARCHAR(255) NOT NULL, + NAME VARCHAR(255) NOT NULL, + CHANNEL VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + CONSTRAINT NOTIFICATION_TYPE_KEY_CONSTRAINT UNIQUE (TYPE_KEY, CHANNEL, TENANT_ID), + CONSTRAINT NOTIFICATION_TYPE_NAME_CONSTRAINT UNIQUE (NAME, CHANNEL, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_ORG_TEMPLATE ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TEMPLATE_KEY VARCHAR(50) NOT NULL, + LOCALE VARCHAR(50) NOT NULL, + SUBJECT VARCHAR(4000), + BODY MEDIUMTEXT, + FOOTER MEDIUMTEXT, + CONTENT_TYPE VARCHAR(50), + TYPE_ID INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, + CONSTRAINT ORG_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, TENANT_ID), + CONSTRAINT ORG_NOTIFICATION_TEMPLATE_LOCALE_CONSTRAINT UNIQUE (LOCALE, TYPE_ID, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_NOTIFICATION_APP_TEMPLATE ( + ID INTEGER NOT NULL AUTO_INCREMENT, + TEMPLATE_KEY VARCHAR(50) NOT NULL, + LOCALE VARCHAR(50) NOT NULL, + SUBJECT VARCHAR(4000), + BODY MEDIUMTEXT, + FOOTER MEDIUMTEXT, + CONTENT_TYPE VARCHAR(50), + TYPE_ID INTEGER NOT NULL, + APP_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (TYPE_ID) REFERENCES IDN_NOTIFICATION_TYPE(ID) ON DELETE CASCADE, + CONSTRAINT APP_NOTIFICATION_TEMPLATE_KEY_CONSTRAINT UNIQUE (TEMPLATE_KEY, TYPE_ID, APP_ID, TENANT_ID), + CONSTRAINT APP_NOTIFICATION_TEMPLATE_LOCALE_CONSTRAINT UNIQUE (LOCALE, TYPE_ID, APP_ID, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_XACML_CONFIG ( + CONFIG_KEY VARCHAR(255) NOT NULL, + CONFIG_VALUE VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (TENANT_ID, CONFIG_KEY) +); + +CREATE TABLE IF NOT EXISTS IDN_XACML_POLICY ( + POLICY_ID VARCHAR(255) NOT NULL, + VERSION INTEGER NOT NULL, + IS_IN_PAP BOOLEAN NOT NULL DEFAULT TRUE, + IS_IN_PDP BOOLEAN NOT NULL DEFAULT FALSE, + POLICY CLOB NOT NULL, + IS_ACTIVE BOOLEAN NOT NULL DEFAULT FALSE, + POLICY_TYPE VARCHAR(255) NOT NULL, + POLICY_EDITOR VARCHAR(255), + POLICY_ORDER INTEGER NOT NULL, + LAST_MODIFIED_TIME TIMESTAMP NOT NULL, + LAST_MODIFIED_USER VARCHAR(255), + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (POLICY_ID, VERSION, TENANT_ID), + CONSTRAINT IDN_XACML_POLICY_KEY_CONSTRAINT UNIQUE (POLICY_ID, VERSION, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_XACML_POLICY_ATTRIBUTE ( + ID INTEGER AUTO_INCREMENT NOT NULL, + ATTRIBUTE_ID VARCHAR(255) NOT NULL, + ATTRIBUTE_VALUE VARCHAR(255) NOT NULL, + DATA_TYPE VARCHAR(255) NOT NULL, + CATEGORY VARCHAR(255) NOT NULL, + POLICY_ID VARCHAR(255) NOT NULL, + VERSION INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (POLICY_ID, VERSION, TENANT_ID) REFERENCES IDN_XACML_POLICY (POLICY_ID, VERSION, TENANT_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_XACML_POLICY_EDITOR_DATA ( + ID INTEGER AUTO_INCREMENT NOT NULL, + DATA VARCHAR(500), + DATA_ORDER INTEGER NOT NULL, + POLICY_ID VARCHAR(255) NOT NULL, + VERSION INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (POLICY_ID, VERSION, TENANT_ID) REFERENCES IDN_XACML_POLICY (POLICY_ID, VERSION, TENANT_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_XACML_POLICY_REFERENCE ( + REFERENCE VARCHAR(255) NOT NULL, + POLICY_ID VARCHAR(255) NOT NULL, + VERSION INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (REFERENCE, POLICY_ID, VERSION, TENANT_ID), + FOREIGN KEY (POLICY_ID, VERSION, TENANT_ID) REFERENCES IDN_XACML_POLICY (POLICY_ID, VERSION, TENANT_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_XACML_POLICY_SET_REFERENCE ( + SET_REFERENCE VARCHAR(255) NOT NULL, + POLICY_ID VARCHAR(255) NOT NULL, + VERSION INTEGER NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (SET_REFERENCE, POLICY_ID, VERSION, TENANT_ID), + FOREIGN KEY (POLICY_ID, VERSION, TENANT_ID) REFERENCES IDN_XACML_POLICY (POLICY_ID, VERSION, TENANT_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_XACML_SUBSCRIBER ( + SUBSCRIBER_ID VARCHAR(255) NOT NULL, + ENTITLEMENT_MODULE_NAME VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (SUBSCRIBER_ID, TENANT_ID), + CONSTRAINT IDN_XACML_SUBSCRIBER_KEY_CONSTRAINT UNIQUE (SUBSCRIBER_ID, TENANT_ID) +); + +CREATE TABLE IF NOT EXISTS IDN_XACML_SUBSCRIBER_PROPERTY ( + PROPERTY_ID VARCHAR(255) NOT NULL, + DISPLAY_NAME VARCHAR(255) NOT NULL, + PROPERTY_VALUE VARCHAR(2000) NOT NULL, + IS_REQUIRED BOOLEAN NOT NULL DEFAULT FALSE, + DISPLAY_ORDER INTEGER NOT NULL, + IS_SECRET BOOLEAN NOT NULL DEFAULT FALSE, + PROPERTY_MODULE VARCHAR(255), + SUBSCRIBER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (PROPERTY_ID, SUBSCRIBER_ID, TENANT_ID), + FOREIGN KEY (SUBSCRIBER_ID, TENANT_ID) REFERENCES IDN_XACML_SUBSCRIBER (SUBSCRIBER_ID, TENANT_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_XACML_SUBSCRIBER_STATUS ( + ID INTEGER AUTO_INCREMENT NOT NULL, + TYPE VARCHAR(255) NOT NULL, + IS_SUCCESS BOOLEAN NOT NULL DEFAULT FALSE, + USERNAME VARCHAR(255) NOT NULL, + TARGET VARCHAR(255) NOT NULL, + TARGET_ACTION VARCHAR(255) NOT NULL, + LOGGED_AT TIMESTAMP NOT NULL, + MESSAGE VARCHAR(255) NULL, + SUBSCRIBER_ID VARCHAR(255) NOT NULL, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID), + FOREIGN KEY (SUBSCRIBER_ID, TENANT_ID) REFERENCES IDN_XACML_SUBSCRIBER (SUBSCRIBER_ID, TENANT_ID) ON DELETE CASCADE +); + +CREATE TABLE IF NOT EXISTS IDN_XACML_POLICY_STATUS ( + ID INTEGER AUTO_INCREMENT NOT NULL, + TYPE VARCHAR(255) NOT NULL, + IS_SUCCESS BOOLEAN NOT NULL DEFAULT FALSE, + USERNAME VARCHAR(255) NOT NULL, + TARGET VARCHAR(255) NOT NULL, + TARGET_ACTION VARCHAR(255) NOT NULL, + LOGGED_AT TIMESTAMP NOT NULL, + MESSAGE VARCHAR(255) NULL, + POLICY_ID VARCHAR(255) NOT NULL, + POLICY_VERSION INTEGER DEFAULT -1, + TENANT_ID INTEGER NOT NULL, + PRIMARY KEY (ID) +); + +-- --------------------------- INDEX CREATION ----------------------------- +-- IDN_OAUTH2_ACCESS_TOKEN -- +CREATE INDEX IDX_TC ON IDN_OAUTH2_ACCESS_TOKEN(TIME_CREATED); +CREATE INDEX IDX_ATH ON IDN_OAUTH2_ACCESS_TOKEN(ACCESS_TOKEN_HASH); +CREATE INDEX IDX_AT_TI_UD ON IDN_OAUTH2_ACCESS_TOKEN(AUTHZ_USER, TENANT_ID, TOKEN_STATE, USER_DOMAIN); +CREATE INDEX IDX_AT_AT ON IDN_OAUTH2_ACCESS_TOKEN(ACCESS_TOKEN); +CREATE INDEX IDX_AT_RTH ON IDN_OAUTH2_ACCESS_TOKEN(REFRESH_TOKEN_HASH); +CREATE INDEX IDX_AT_RT ON IDN_OAUTH2_ACCESS_TOKEN(REFRESH_TOKEN); +CREATE INDEX IDX_TBR_TS ON IDN_OAUTH2_ACCESS_TOKEN(TOKEN_BINDING_REF, TOKEN_STATE); + +-- IDN_OAUTH2_AUTHORIZATION_CODE -- +CREATE INDEX IDX_AUTHORIZATION_CODE_HASH ON IDN_OAUTH2_AUTHORIZATION_CODE (AUTHORIZATION_CODE_HASH, CONSUMER_KEY_ID); +CREATE INDEX IDX_AUTHORIZATION_CODE_AU_TI ON IDN_OAUTH2_AUTHORIZATION_CODE (AUTHZ_USER, TENANT_ID, USER_DOMAIN, STATE); +CREATE INDEX IDX_AC_CKID ON IDN_OAUTH2_AUTHORIZATION_CODE(CONSUMER_KEY_ID); +CREATE INDEX IDX_AC_TID ON IDN_OAUTH2_AUTHORIZATION_CODE(TOKEN_ID); +CREATE INDEX IDX_AC_AC_CKID ON IDN_OAUTH2_AUTHORIZATION_CODE(AUTHORIZATION_CODE, CONSUMER_KEY_ID); +CREATE INDEX IDX_AT_CKID_AU_TID_UD_TSH_TS ON IDN_OAUTH2_ACCESS_TOKEN(CONSUMER_KEY_ID, AUTHZ_USER, TENANT_ID, USER_DOMAIN, TOKEN_SCOPE_HASH, TOKEN_STATE); + +-- IDN_SCIM_GROUP -- +CREATE INDEX IDX_IDN_SCIM_GROUP_TI_RN ON IDN_SCIM_GROUP (TENANT_ID, ROLE_NAME); +CREATE INDEX IDX_IDN_SCIM_GROUP_TI_RN_AN ON IDN_SCIM_GROUP (TENANT_ID, ROLE_NAME, ATTR_NAME); + +-- IDN_AUTH_SESSION_STORE -- +CREATE INDEX IDX_IDN_AUTH_SESSION_TIME ON IDN_AUTH_SESSION_STORE (TIME_CREATED); +CREATE INDEX IDX_IDN_AUTH_SSTR_ST_OP_ID_TM ON IDN_AUTH_SESSION_STORE (OPERATION, SESSION_TYPE, SESSION_ID, TIME_CREATED); +CREATE INDEX IDX_IDN_AUTH_SSTR_ET_ID ON IDN_AUTH_SESSION_STORE (EXPIRY_TIME, SESSION_ID); + +-- IDN_AUTH_TEMP_SESSION_STORE -- +CREATE INDEX IDX_IDN_AUTH_TMP_SESSION_TIME ON IDN_AUTH_TEMP_SESSION_STORE (TIME_CREATED); + +-- IDN_OIDC_SCOPE_CLAIM_MAPPING -- +CREATE INDEX IDX_AT_SI_ECI ON IDN_OIDC_SCOPE_CLAIM_MAPPING(SCOPE_ID, EXTERNAL_CLAIM_ID); + +-- IDN_OAUTH2_SCOPE -- +CREATE INDEX IDX_SC_TID ON IDN_OAUTH2_SCOPE(TENANT_ID); + +-- IDN_OAUTH2_SCOPE_BINDING -- +CREATE INDEX IDX_SB_SCPID ON IDN_OAUTH2_SCOPE_BINDING(SCOPE_ID); + +-- IDN_OIDC_REQ_OBJECT_REFERENCE -- +CREATE INDEX IDX_OROR_TID ON IDN_OIDC_REQ_OBJECT_REFERENCE(TOKEN_ID); + +-- IDN_OAUTH2_ACCESS_TOKEN_SCOPE -- +CREATE INDEX IDX_ATS_TID ON IDN_OAUTH2_ACCESS_TOKEN_SCOPE(TOKEN_ID); + +-- SP_TEMPLATE -- +CREATE INDEX IDX_SP_TEMPLATE ON SP_TEMPLATE (TENANT_ID, NAME); + +-- IDN_AUTH_USER -- +CREATE INDEX IDX_AUTH_USER_UN_TID_DN ON IDN_AUTH_USER (USER_NAME, TENANT_ID, DOMAIN_NAME); +CREATE INDEX IDX_AUTH_USER_DN_TOD ON IDN_AUTH_USER (DOMAIN_NAME, TENANT_ID); + +-- IDN_AUTH_USER_SESSION_MAPPING -- +CREATE INDEX IDX_USER_ID ON IDN_AUTH_USER_SESSION_MAPPING (USER_ID); +CREATE INDEX IDX_SESSION_ID ON IDN_AUTH_USER_SESSION_MAPPING (SESSION_ID); + +-- IDN_AUTH_SESSION_APP_INFO -- +CREATE INDEX IDX_AUTH_SAI_UN_AID_SID ON IDN_AUTH_SESSION_APP_INFO (APP_ID, SUBJECT, SESSION_ID); + +-- IDN_OAUTH_CONSUMER_APPS -- +CREATE INDEX IDX_OCA_UM_TID_UD_APN ON IDN_OAUTH_CONSUMER_APPS(USERNAME,TENANT_ID,USER_DOMAIN, APP_NAME); + +-- IDX_SPI_APP -- +CREATE INDEX IDX_SPI_APP ON SP_INBOUND_AUTH(APP_ID); + +-- IDN_OIDC_PROPERTY -- +CREATE INDEX IDX_IOP_CK ON IDN_OIDC_PROPERTY(TENANT_ID, CONSUMER_KEY); + +-- IDN_FIDO2_PROPERTY -- +CREATE INDEX IDX_FIDO2_STR ON FIDO2_DEVICE_STORE(USER_NAME, TENANT_ID, DOMAIN_NAME, CREDENTIAL_ID, USER_HANDLE); + +-- IDN_ASSOCIATED_ID -- +CREATE INDEX IDX_AI_DN_UN_AI ON IDN_ASSOCIATED_ID(DOMAIN_NAME, USER_NAME, ASSOCIATION_ID); + +-- IDN_OAUTH2_TOKEN_BINDING -- +CREATE INDEX IDX_IDN_AUTH_BIND ON IDN_OAUTH2_TOKEN_BINDING (TOKEN_BINDING_REF); +CREATE INDEX IDX_TK_VALUE_TYPE ON IDN_OAUTH2_TOKEN_BINDING (TOKEN_BINDING_VALUE, TOKEN_BINDING_TYPE); + +-- IDN_FED_AUTH_SESSION_MAPPING -- +CREATE INDEX IDX_FEDERATED_AUTH_SESSION_ID ON IDN_FED_AUTH_SESSION_MAPPING (SESSION_ID); + +-- IDN_REMOTE_FETCH_REVISIONS -- +CREATE INDEX IDX_REMOTE_FETCH_REVISION_CONFIG_ID ON IDN_REMOTE_FETCH_REVISIONS (CONFIG_ID); + +-- IDN_CORS_ASSOCIATION -- +CREATE INDEX IDX_CORS_SP_APP_ID ON IDN_CORS_ASSOCIATION (SP_APP_ID); + +-- IDN_CORS_ASSOCIATION -- +CREATE INDEX IDX_CORS_ORIGIN_ID ON IDN_CORS_ASSOCIATION (IDN_CORS_ORIGIN_ID); + +-- IDN_SECRET -- +CREATE INDEX IDN_SECRET_TYPE_ID ON IDN_SECRET (TYPE_ID); + +-- IDN_CLAIM -- +CREATE INDEX IDX_CLAIM_TI_CU ON IDN_CLAIM (TENANT_ID, CLAIM_URI); + +-- IDP_AUTHENTICATOR_PROPERTY -- +CREATE INDEX IDX_AUTH_PROP_AUTH_ID ON IDP_AUTHENTICATOR_PROPERTY (AUTHENTICATOR_ID); + +-- IDN_CONFIG_FILE -- +CREATE INDEX IDX_CON_FILE_RES_ID ON IDN_CONFIG_FILE (RESOURCE_ID); + +-- SCOPE -- +CREATE INDEX API_ID_NAME_INDEX ON SCOPE (API_ID, NAME); + +-- XACML -- +CREATE INDEX IDX_POLICY_ATTRIBUTE ON IDN_XACML_POLICY_ATTRIBUTE (POLICY_ID, VERSION, TENANT_ID); +CREATE INDEX IDX_POLICY_EDITOR_DATA_FK ON IDN_XACML_POLICY_EDITOR_DATA (POLICY_ID, VERSION, TENANT_ID); +CREATE INDEX IDX_POLICY_REF ON IDN_XACML_POLICY_REFERENCE (POLICY_ID, VERSION, TENANT_ID); +CREATE INDEX IDX_POLICY_SET_REF ON IDN_XACML_POLICY_SET_REFERENCE (POLICY_ID, VERSION, TENANT_ID); +CREATE INDEX IDX_SUBSCRIBER_PROPERTY ON IDN_XACML_SUBSCRIBER_PROPERTY (SUBSCRIBER_ID, TENANT_ID); +CREATE INDEX IDX_XACML_SUBSCRIBER_STATUS ON IDN_XACML_SUBSCRIBER_STATUS (SUBSCRIBER_ID, TENANT_ID); +CREATE INDEX IDX_XACML_POLICY_STATUS ON IDN_XACML_POLICY_STATUS (POLICY_ID, POLICY_VERSION, TENANT_ID); diff --git a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/testng.xml b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/testng.xml index de97c292bc57..992aa94d901f 100644 --- a/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/testng.xml +++ b/components/entitlement/org.wso2.carbon.identity.entitlement/src/test/resources/testng.xml @@ -22,6 +22,9 @@ + + + diff --git a/components/entitlement/pom.xml b/components/entitlement/pom.xml index 65f9ba31bb04..8ada0109ca91 100644 --- a/components/entitlement/pom.xml +++ b/components/entitlement/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/extension-mgt/org.wso2.carbon.identity.extension.mgt/pom.xml b/components/extension-mgt/org.wso2.carbon.identity.extension.mgt/pom.xml index 89aee1ba4b6f..4a030be0413f 100644 --- a/components/extension-mgt/org.wso2.carbon.identity.extension.mgt/pom.xml +++ b/components/extension-mgt/org.wso2.carbon.identity.extension.mgt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework extension-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -150,7 +150,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.xml/jdk.xml.internal=ALL-UNNAMED diff --git a/components/extension-mgt/pom.xml b/components/extension-mgt/pom.xml index a991e96ecf1e..5127e509a4a0 100644 --- a/components/extension-mgt/pom.xml +++ b/components/extension-mgt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.ui/pom.xml b/components/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.ui/pom.xml index 79dc347ea776..909169e60056 100644 --- a/components/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.ui/pom.xml +++ b/components/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.ui/pom.xml @@ -21,7 +21,7 @@ functions-library-mgt org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/components/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt/pom.xml b/components/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt/pom.xml index c05958859a21..ef7f3cee71f1 100644 --- a/components/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt/pom.xml +++ b/components/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt/pom.xml @@ -21,7 +21,7 @@ functions-library-mgt org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 @@ -91,18 +91,6 @@ jacoco-maven-plugin ${jacoco.version} - - default-instrument - - instrument - - - - default-restore-instrumented-classes - - restore-instrumented-classes - - default-report prepare-package diff --git a/components/functions-library-mgt/pom.xml b/components/functions-library-mgt/pom.xml index 418b8cb2decb..ad3560583dd3 100644 --- a/components/functions-library-mgt/pom.xml +++ b/components/functions-library-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/identity-core/org.wso2.carbon.identity.base/pom.xml b/components/identity-core/org.wso2.carbon.identity.base/pom.xml index d170e5553f5d..b32fe908aa46 100644 --- a/components/identity-core/org.wso2.carbon.identity.base/pom.xml +++ b/components/identity-core/org.wso2.carbon.identity.base/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-core - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/identity-core/org.wso2.carbon.identity.core.ui/pom.xml b/components/identity-core/org.wso2.carbon.identity.core.ui/pom.xml index fe100a616aba..1df844463f27 100644 --- a/components/identity-core/org.wso2.carbon.identity.core.ui/pom.xml +++ b/components/identity-core/org.wso2.carbon.identity.core.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-core - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/identity-core/org.wso2.carbon.identity.core/pom.xml b/components/identity-core/org.wso2.carbon.identity.core/pom.xml index afffa2c8e256..c42d6d617ba0 100644 --- a/components/identity-core/org.wso2.carbon.identity.core/pom.xml +++ b/components/identity-core/org.wso2.carbon.identity.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-core - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -225,7 +225,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens=java.base/java.util=ALL-UNNAMED diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/IdentityKeyStoreResolver.java b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/IdentityKeyStoreResolver.java new file mode 100644 index 000000000000..aafa1f2d3f01 --- /dev/null +++ b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/IdentityKeyStoreResolver.java @@ -0,0 +1,591 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.core; + +import org.apache.axiom.om.OMElement; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.CarbonException; +import org.wso2.carbon.base.MultitenantConstants; +import org.wso2.carbon.core.RegistryResources; +import org.wso2.carbon.core.util.KeyStoreManager; +import org.wso2.carbon.core.util.KeyStoreUtil; +import org.wso2.carbon.identity.core.model.IdentityKeyStoreMapping; +import org.wso2.carbon.identity.core.util.IdentityConfigParser; +import org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverConstants; +import org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverConstants.InboundProtocol; +import org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverException; +import org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverUtil; +import org.wso2.carbon.identity.core.util.IdentityTenantUtil; +import org.wso2.carbon.utils.CarbonUtils; + +import java.io.File; +import java.security.Key; +import java.security.KeyStore; +import java.security.cert.Certificate; +import java.security.interfaces.RSAPublicKey; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import static org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverConstants.ErrorMessages; + + +/** + * KeyStore manager for inbound authentication protocols. + * Retrieve keystores, private keys, public keys and public certificates. + */ +public class IdentityKeyStoreResolver { + + private static IdentityKeyStoreResolver instance = null; + + private static ConcurrentHashMap + keyStoreMappings = new ConcurrentHashMap<>(); + + // Hashmaps to store retrieved private keys and certificates. + // This will reduce the time required to read configs and load data from keystores everytime. + private static Map privateKeys = new ConcurrentHashMap<>(); + private static Map publicCerts = new ConcurrentHashMap<>(); + + private static final Log LOG = LogFactory.getLog(IdentityKeyStoreResolver.class); + + private IdentityKeyStoreResolver() { + + parseIdentityKeyStoreMappingConfigs(); + } + + public static IdentityKeyStoreResolver getInstance() { + + if (instance == null) { + instance = new IdentityKeyStoreResolver(); + } + return instance; + } + + /** + * Return Primary or tenant keystore according to given tenant domain. + * + * @param tenantDomain Tenant domain. + * @return Primary or tenant keystore. + * @throws IdentityKeyStoreResolverException the exception in the IdentityKeyStoreResolver class. + */ + private KeyStore getKeyStore(String tenantDomain) throws IdentityKeyStoreResolverException { + + int tenantId = IdentityTenantUtil.getTenantId(tenantDomain); + KeyStoreManager keyStoreManager = KeyStoreManager.getInstance(tenantId); + try { + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { + // Get primary keystore from keyStoreManager + return keyStoreManager.getPrimaryKeyStore(); + } + + // Get tenant keystore from keyStoreManager + String tenantKeyStoreName = IdentityKeyStoreResolverUtil.buildTenantKeyStoreName(tenantDomain); + return keyStoreManager.getKeyStore(tenantKeyStoreName); + } catch (Exception e) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_TENANT_KEYSTORE.getCode(), + String.format(ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_TENANT_KEYSTORE.getDescription(), + tenantDomain), e); + } + } + + /** + * Return Primary, tenant or custom keystore. + * + * @param tenantDomain Tenant domain. + * @param inboundProtocol Inbound authentication protocol of the application. + * @return Primary, tenant or custom keystore. + * @throws IdentityKeyStoreResolverException the exception in the IdentityKeyStoreResolver class. + */ + public KeyStore getKeyStore(String tenantDomain, InboundProtocol inboundProtocol) + throws IdentityKeyStoreResolverException { + + if (StringUtils.isEmpty(tenantDomain)) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Tenant domain")); + } + if (inboundProtocol == null) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Inbound protocol")); + } + + if (keyStoreMappings.containsKey(inboundProtocol)) { + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain) || + keyStoreMappings.get(inboundProtocol).getUseInAllTenants()) { + + String keyStoreName = IdentityKeyStoreResolverUtil.buildCustomKeyStoreName( + keyStoreMappings.get(inboundProtocol).getKeyStoreName()); + + if (LOG.isDebugEnabled()) { + LOG.debug("Custom key store configuration available for " + inboundProtocol + " protocol. " + + "Retrieving keystore " + keyStoreName); + } + + try { + int tenantId = IdentityTenantUtil.getTenantId(tenantDomain); + KeyStoreManager keyStoreManager = KeyStoreManager.getInstance(tenantId); + return keyStoreManager.getKeyStore(keyStoreName); + } catch (Exception e) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_CUSTOM_KEYSTORE.getCode(), + String.format(ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_CUSTOM_KEYSTORE.getDescription(), + keyStoreName), e); + } + } + } + + return getKeyStore(tenantDomain); + } + + /** + * Return Primary key of the Primary or tenant keystore according to given tenant domain. + * + * @param tenantDomain Tenant domain. + * @return Primary key of Primary or tenant keystore. + * @throws IdentityKeyStoreResolverException the exception in the IdentityKeyStoreResolver class. + */ + private Key getPrivateKey(String tenantDomain) throws IdentityKeyStoreResolverException { + + int tenantId = IdentityTenantUtil.getTenantId(tenantDomain); + if (privateKeys.containsKey(String.valueOf(tenantId))) { + return privateKeys.get(String.valueOf(tenantId)); + } + + KeyStoreManager keyStoreManager = KeyStoreManager.getInstance(tenantId); + Key privateKey; + + try { + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { + privateKey = keyStoreManager.getDefaultPrivateKey(); + } else { + String tenantKeyStoreName = IdentityKeyStoreResolverUtil.buildTenantKeyStoreName(tenantDomain); + privateKey = keyStoreManager.getPrivateKey(tenantKeyStoreName, tenantDomain); + } + } catch (Exception e) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_TENANT_PRIVATE_KEY.getCode(), + String.format(ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_TENANT_PRIVATE_KEY.getDescription(), + tenantDomain), e); + } + + privateKeys.put(String.valueOf(tenantId), privateKey); + return privateKey; + } + + /** + * Return Private Key of the Primary, tenant or custom keystore. + * + * @param tenantDomain Tenant domain. + * @param inboundProtocol Inbound authentication protocol of the application. + * @return Private Key of the Primary, tenant or custom keystore. + * @throws IdentityKeyStoreResolverException the exception in the IdentityKeyStoreResolver class. + */ + public Key getPrivateKey(String tenantDomain, InboundProtocol inboundProtocol) + throws IdentityKeyStoreResolverException { + + if (StringUtils.isEmpty(tenantDomain)) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Tenant domain")); + } + if (inboundProtocol == null) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Inbound protocol")); + } + + if (keyStoreMappings.containsKey(inboundProtocol)) { + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain) || + keyStoreMappings.get(inboundProtocol).getUseInAllTenants()) { + + String keyStoreName = IdentityKeyStoreResolverUtil.buildCustomKeyStoreName( + keyStoreMappings.get(inboundProtocol).getKeyStoreName()); + + if (LOG.isDebugEnabled()) { + LOG.debug("Custom key store configuration available for " + inboundProtocol + " protocol. " + + "Retrieving private key from " + keyStoreName + " key store."); + } + + if (privateKeys.containsKey(inboundProtocol.toString())) { + return privateKeys.get(inboundProtocol.toString()); + } + + try { + int tenantId = IdentityTenantUtil.getTenantId(tenantDomain); + KeyStoreManager keyStoreManager = KeyStoreManager.getInstance(tenantId); + Key privateKey = keyStoreManager.getPrivateKey(keyStoreName, null); + privateKeys.put(inboundProtocol.toString(), privateKey); + return privateKey; + } catch (Exception e) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_CUSTOM_PRIVATE_KEY.getCode(), + String.format(ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_CUSTOM_PRIVATE_KEY.getDescription(), + keyStoreName), e); + } + } + } + return getPrivateKey(tenantDomain); + } + + /** + * Return Public Certificate of the Primary or tenant keystore according to given tenant domain. + * + * @param tenantDomain Tenant domain. + * @return Public Certificate of Primary or tenant keystore. + * @throws IdentityKeyStoreResolverException the exception in the IdentityKeyStoreResolver class. + */ + private Certificate getCertificate(String tenantDomain) throws IdentityKeyStoreResolverException { + + int tenantId = IdentityTenantUtil.getTenantId(tenantDomain); + if (publicCerts.containsKey(String.valueOf(tenantId))) { + return publicCerts.get(String.valueOf(tenantId)); + } + + KeyStoreManager keyStoreManager = KeyStoreManager.getInstance(tenantId); + Certificate publicCert; + try { + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { + publicCert = keyStoreManager.getDefaultPrimaryCertificate(); + } else { + String tenantKeyStoreName = IdentityKeyStoreResolverUtil.buildTenantKeyStoreName(tenantDomain); + publicCert = keyStoreManager.getCertificate(tenantKeyStoreName, tenantDomain); + } + } catch (Exception e) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_TENANT_PUBLIC_CERTIFICATE.getCode(), + String.format(ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_TENANT_PUBLIC_CERTIFICATE.getDescription(), + tenantDomain), e); + } + + publicCerts.put(String.valueOf(tenantId), publicCert); + return publicCert; + } + + /** + * Return Public Certificate of the Primary, tenant or custom keystore. + * + * @param tenantDomain Tenant domain. + * @param inboundProtocol Inbound authentication protocol of the application. + * @return Public Certificate of the Primary, tenant or custom keystore. + * @throws IdentityKeyStoreResolverException the exception in the IdentityKeyStoreResolver class. + */ + public Certificate getCertificate(String tenantDomain, InboundProtocol inboundProtocol) + throws IdentityKeyStoreResolverException { + + if (StringUtils.isEmpty(tenantDomain)) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Tenant domain")); + } + if (inboundProtocol == null) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Inbound protocol")); + } + + if (keyStoreMappings.containsKey(inboundProtocol)) { + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain) || + keyStoreMappings.get(inboundProtocol).getUseInAllTenants()) { + + String keyStoreName = IdentityKeyStoreResolverUtil.buildCustomKeyStoreName( + keyStoreMappings.get(inboundProtocol).getKeyStoreName()); + + if (LOG.isDebugEnabled()) { + LOG.debug("Custom key store configuration available for " + inboundProtocol + " protocol. " + + "Retrieving public certificate from " + keyStoreName + " key store."); + } + + if (publicCerts.containsKey(inboundProtocol.toString())) { + return publicCerts.get(inboundProtocol.toString()); + } + + try { + int tenantId = IdentityTenantUtil.getTenantId(tenantDomain); + KeyStoreManager keyStoreManager = KeyStoreManager.getInstance(tenantId); + Certificate publicCert = keyStoreManager.getCertificate(keyStoreName, null); + publicCerts.put(inboundProtocol.toString(), publicCert); + return publicCert; + } catch (Exception e) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_CUSTOM_PUBLIC_CERTIFICATE.getCode(), + String.format(ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_CUSTOM_PUBLIC_CERTIFICATE + .getDescription(), keyStoreName), e); + } + } + } + return getCertificate(tenantDomain); + } + + /** + * Return Public Key of the Primary or tenant keystore according to given tenant domain. + * + * @param tenantDomain Tenant domain. + * @return Public Key of Primary or tenant keystore. + * @throws IdentityKeyStoreResolverException the exception in the IdentityKeyStoreResolver class. + */ + private RSAPublicKey getPublicKey(String tenantDomain) throws IdentityKeyStoreResolverException { + + return (RSAPublicKey) getCertificate(tenantDomain).getPublicKey(); + } + + /** + * Return Public Key of the Primary, tenant or custom keystore. + * + * @param tenantDomain Tenant domain. + * @param inboundProtocol Inbound authentication protocol of the application. + * @return Public Key of the Primary, tenant or custom keystore. + * @throws IdentityKeyStoreResolverException the exception in the IdentityKeyStoreResolver class. + */ + public RSAPublicKey getPublicKey(String tenantDomain, InboundProtocol inboundProtocol) + throws IdentityKeyStoreResolverException { + + // Conditions are checked in getCertificate method + return (RSAPublicKey) getCertificate(tenantDomain, inboundProtocol).getPublicKey(); + } + + /** + * Return keystore name of the Primary, tenant or custom keystore. + * + * @param tenantDomain Tenant domain. + * @param inboundProtocol Inbound authentication protocol of the application. + * @return Keystore name of the Primary, tenant or custom keystore. + * @throws IdentityKeyStoreResolverException the exception in the IdentityKeyStoreResolver class. + */ + public String getKeyStoreName(String tenantDomain, InboundProtocol inboundProtocol) + throws IdentityKeyStoreResolverException { + + if (StringUtils.isEmpty(tenantDomain)) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Tenant domain")); + } + if (inboundProtocol == null) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Inbound protocol")); + } + + if (keyStoreMappings.containsKey(inboundProtocol)) { + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain) || + keyStoreMappings.get(inboundProtocol).getUseInAllTenants()) { + + return IdentityKeyStoreResolverUtil.buildCustomKeyStoreName( + keyStoreMappings.get(inboundProtocol).getKeyStoreName()); + } + } + + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { + try { + File keyStoreFile = new File(getPrimaryKeyStoreConfig( + RegistryResources.SecurityManagement.CustomKeyStore.PROP_LOCATION)); + return keyStoreFile.getName(); + } catch (Exception e) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_PRIMARY_KEYSTORE_CONFIGURATION.getCode(), + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_PRIMARY_KEYSTORE_CONFIGURATION.getDescription(), e); + } + } + + return IdentityKeyStoreResolverUtil.buildTenantKeyStoreName(tenantDomain); + } + + /** + * Return key store configs of the Primary, tenant or custom keystore. + * + * @param tenantDomain Tenant domain. + * @param inboundProtocol Inbound authentication protocol of the application. + * @param configName Name of the configuration needed. + * @return Configuration value. + * @throws IdentityKeyStoreResolverException the exception in the IdentityKeyStoreResolver class. + */ + public String getKeyStoreConfig(String tenantDomain, InboundProtocol inboundProtocol, String configName) + throws IdentityKeyStoreResolverException { + + if (StringUtils.isEmpty(tenantDomain)) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Tenant domain")); + } + if (inboundProtocol == null) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Inbound protocol")); + } + if (StringUtils.isEmpty(configName)) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Config name")); + } + + if (keyStoreMappings.containsKey(inboundProtocol)) { + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain) || + keyStoreMappings.get(inboundProtocol).getUseInAllTenants()) { + + String keyStoreName = IdentityKeyStoreResolverUtil.buildCustomKeyStoreName( + keyStoreMappings.get(inboundProtocol).getKeyStoreName()); + + if (LOG.isDebugEnabled()) { + LOG.debug("Custom key store configuration available for " + inboundProtocol + " protocol. " + + "Retreiving " + configName + " config for " + keyStoreName + " key store."); + } + + return getCustomKeyStoreConfig(keyStoreName, configName); + } + } + + if (MultitenantConstants.SUPER_TENANT_DOMAIN_NAME.equals(tenantDomain)) { + return getPrimaryKeyStoreConfig(configName); + } + + return getTenantKeyStoreConfig(tenantDomain, configName); + + } + + private String getPrimaryKeyStoreConfig(String configName) throws IdentityKeyStoreResolverException { + + try { + KeyStoreUtil.validateKeyStoreConfigName(configName); + + String fullConfigPath = IdentityKeyStoreResolverConstants.PRIMARY_KEYSTORE_CONFIG_PATH + configName; + return CarbonUtils.getServerConfiguration().getFirstProperty(fullConfigPath); + } catch (CarbonException e) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_PRIMARY_KEYSTORE_CONFIGURATION.getCode(), + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_PRIMARY_KEYSTORE_CONFIGURATION.getDescription(), e); + } + } + + private String getTenantKeyStoreConfig(String tenantDomain, String configName) + throws IdentityKeyStoreResolverException { + + try { + KeyStoreUtil.validateKeyStoreConfigName(configName); + + int tenantId = IdentityTenantUtil.getTenantId(tenantDomain); + KeyStoreManager keyStoreManager = KeyStoreManager.getInstance(tenantId); + String keyStoreName = IdentityKeyStoreResolverUtil.buildTenantKeyStoreName(tenantDomain); + switch (configName) { + case (RegistryResources.SecurityManagement.CustomKeyStore.PROP_LOCATION): + // Returning only key store name because tenant key stores reside within the registry. + return keyStoreName; + case (RegistryResources.SecurityManagement.CustomKeyStore.PROP_TYPE): + KeyStore keyStore = keyStoreManager.getKeyStore(keyStoreName); + return keyStore.getType(); + case (RegistryResources.SecurityManagement.CustomKeyStore.PROP_PASSWORD): + return keyStoreManager.getKeyStorePassword(keyStoreName); + case (RegistryResources.SecurityManagement.CustomKeyStore.PROP_KEY_PASSWORD): + return keyStoreManager.getKeyStorePassword(keyStoreName); + case (RegistryResources.SecurityManagement.CustomKeyStore.PROP_KEY_ALIAS): + return tenantDomain; + default: + // This state is not possible since config name is validated above. + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_TENANT_KEYSTORE_CONFIGURATION.getCode(), + String.format(ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_TENANT_KEYSTORE_CONFIGURATION + .getDescription(), tenantDomain)); + } + } catch (Exception e) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_TENANT_KEYSTORE_CONFIGURATION.getCode(), + String.format(ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_TENANT_KEYSTORE_CONFIGURATION + .getDescription(), tenantDomain), e); + } + } + + private String getCustomKeyStoreConfig(String keyStoreName, String configName) + throws IdentityKeyStoreResolverException { + + try { + KeyStoreUtil.validateKeyStoreConfigName(configName); + + OMElement configElement = KeyStoreUtil + .getCustomKeyStoreConfigElement(keyStoreName, CarbonUtils.getServerConfiguration()); + return KeyStoreUtil.getCustomKeyStoreConfig(configElement, configName); + } catch (CarbonException e) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_CUSTOM_KEYSTORE_CONFIGURATION.getCode(), + String.format(ErrorMessages.ERROR_CODE_ERROR_RETRIEVING_CUSTOM_KEYSTORE_CONFIGURATION + .getDescription(), keyStoreName), e); + } + } + + private void parseIdentityKeyStoreMappingConfigs() { + + OMElement keyStoreMappingsElem = IdentityConfigParser.getInstance().getConfigElement( + IdentityKeyStoreResolverConstants.CONFIG_ELEM_SECURITY).getFirstChildWithName( + IdentityKeyStoreResolverUtil.getQNameWithIdentityNameSpace( + IdentityKeyStoreResolverConstants.CONFIG_ELEM_KEYSTORE_MAPPING)); + + // Parse OAuth KeyStore Mapping. + OMElement oauthKeyStoreMapping = keyStoreMappingsElem.getFirstChildWithName( + IdentityKeyStoreResolverUtil.getQNameWithIdentityNameSpace( + IdentityKeyStoreResolverConstants.CONFIG_ELEM_OAUTH)); + if (oauthKeyStoreMapping != null) { + addKeyStoreMapping(InboundProtocol.OAUTH, oauthKeyStoreMapping); + } + + // Parse WS-Trust KeyStore Mapping. + OMElement wsTrustKeyStoreMapping = keyStoreMappingsElem.getFirstChildWithName( + IdentityKeyStoreResolverUtil.getQNameWithIdentityNameSpace( + IdentityKeyStoreResolverConstants.CONFIG_ELEM_WS_TRUST)); + if (wsTrustKeyStoreMapping != null) { + addKeyStoreMapping(InboundProtocol.WS_TRUST, wsTrustKeyStoreMapping); + } + + // Parse WS-Federation KeyStore Mapping. + OMElement wsFedKeyStoreMapping = keyStoreMappingsElem.getFirstChildWithName( + IdentityKeyStoreResolverUtil.getQNameWithIdentityNameSpace( + IdentityKeyStoreResolverConstants.CONFIG_ELEM_WS_FEDERATION)); + if (wsFedKeyStoreMapping != null) { + addKeyStoreMapping(InboundProtocol.WS_FEDERATION, wsFedKeyStoreMapping); + } + } + + private void addKeyStoreMapping(InboundProtocol protocol, OMElement keyStoreMapping) { + + // Parse keystore name + OMElement keyStoreNameElement = keyStoreMapping.getFirstChildWithName( + IdentityKeyStoreResolverUtil.getQNameWithIdentityNameSpace( + IdentityKeyStoreResolverConstants.ATTR_NAME_KEYSTORE_NAME)); + if (keyStoreNameElement == null || keyStoreNameElement.getText().isEmpty()) { + LOG.error("Error occurred when reading KeyStoreMapping configuration. KeyStoreName value null."); + return; + } + String keyStoreName = keyStoreNameElement.getText(); + + // Parse UseInAllTenants config + OMElement useInAllTenantsElement = keyStoreMapping.getFirstChildWithName( + IdentityKeyStoreResolverUtil.getQNameWithIdentityNameSpace( + IdentityKeyStoreResolverConstants.ATTR_NAME_USE_IN_ALL_TENANTS)); + if (useInAllTenantsElement == null || useInAllTenantsElement.getText().isEmpty()) { + if (LOG.isDebugEnabled()) { + LOG.debug("use_in_all_tenants config null for " + protocol.toString() + ". Using default value as false."); + } + } + Boolean useInAllTenants = Boolean.valueOf(useInAllTenantsElement.getText()); + + // Add custom keystore mapping to the map + IdentityKeyStoreMapping identityKeyStoreMapping = new IdentityKeyStoreMapping( + keyStoreName, protocol, useInAllTenants); + keyStoreMappings.put(protocol, identityKeyStoreMapping); + } +} diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/model/IdentityKeyStoreMapping.java b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/model/IdentityKeyStoreMapping.java new file mode 100644 index 000000000000..6e12a62c861a --- /dev/null +++ b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/model/IdentityKeyStoreMapping.java @@ -0,0 +1,55 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.core.model; + +import org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverConstants.InboundProtocol; + +/** + * Class to store IdentityKeyStoreMapping configurations. + */ +public class IdentityKeyStoreMapping { + + private final String keyStoreName; + private final InboundProtocol inboundProtocol; + private final boolean useInAllTenants; + + public IdentityKeyStoreMapping(String keyStoreName, InboundProtocol + inboundProtocol, Boolean useInAllTenants) { + + this.keyStoreName = keyStoreName; + this.inboundProtocol = inboundProtocol; + this.useInAllTenants = useInAllTenants; + } + + public String getKeyStoreName() { + + return keyStoreName; + } + + public InboundProtocol getInboundProtocol() { + + return inboundProtocol; + } + + public boolean getUseInAllTenants() { + + return useInAllTenants; + } + +} diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverConstants.java b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverConstants.java new file mode 100644 index 000000000000..def4bdd725d6 --- /dev/null +++ b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverConstants.java @@ -0,0 +1,155 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.core.util; + +/** + * This class holds the constants used by IdentityKeyStoreManager. + */ +public class IdentityKeyStoreResolverConstants { + + // Primary KeyStore configs. + public static final String PRIMARY_KEYSTORE_CONFIG_PATH = "Security.KeyStore."; + + // CustomKeyStoreMapping config path. + public static final String CONFIG_ELEM_SECURITY = "Security"; + public static final String CONFIG_ELEM_KEYSTORE_MAPPING = "KeyStoreMapping"; + + public static final String CONFIG_ELEM_OAUTH = "OAuth"; + public static final String CONFIG_ELEM_WS_TRUST = "WS-Trust"; + public static final String CONFIG_ELEM_WS_FEDERATION = "WS-Federation"; + + // CustomKeyStoreMapping config attributes. + public static final String ATTR_NAME_PROTOCOL = "Protocol"; + public static final String ATTR_NAME_KEYSTORE_NAME = "KeyStoreName"; + public static final String ATTR_NAME_USE_IN_ALL_TENANTS = "UseInAllTenants"; + + // KeyStore Constants. + public static final String KEY_STORE_EXTENSION = ".jks"; + + // Inbound Protocols. + public static final String INBOUND_PROTOCOL_OAUTH = "oauth"; + public static final String INBOUND_PROTOCOL_SAML = "saml"; + public static final String INBOUND_PROTOCOL_WS_TRUST = "ws-trust"; + public static final String INBOUND_PROTOCOL_WS_FEDERATION = "ws-federation"; + + /** + * Enums for inbound protocols. + */ + public enum InboundProtocol { + + // List of supported inbound protocols + OAUTH(INBOUND_PROTOCOL_OAUTH), + SAML(INBOUND_PROTOCOL_SAML), + WS_TRUST(INBOUND_PROTOCOL_WS_TRUST), + WS_FEDERATION(INBOUND_PROTOCOL_WS_FEDERATION); + + private final String protocolName; + + InboundProtocol(String protocolName) { + this.protocolName = protocolName; + } + + @Override + public String toString() { + return protocolName; + } + + public static InboundProtocol fromString(String protocolName) { + switch(protocolName) { + case INBOUND_PROTOCOL_OAUTH: + return OAUTH; + case INBOUND_PROTOCOL_SAML: + return SAML; + case INBOUND_PROTOCOL_WS_TRUST: + return WS_TRUST; + case INBOUND_PROTOCOL_WS_FEDERATION: + return WS_FEDERATION; + default: + return null; + } + } + } + + /** + * ErrorMessages enum holds the error codes and messages. + * IKSR stands for Identity Key Store Resolver. + */ + public enum ErrorMessages { + // Error codes for errors occurred in Carbon Kernel KeyStoreManager side. + ERROR_CODE_ERROR_RETRIEVING_TENANT_KEYSTORE( + "IKSR-10001", "Error retrieving tenant keystore.", + "Error occurred when retrieving keystore for tenant: %s."), + ERROR_CODE_ERROR_RETRIEVING_CUSTOM_KEYSTORE( + "IKSR-10002", "Error retrieving custom keystore.", + "Error occurred when retrieving custom keystore: %s."), + ERROR_CODE_ERROR_RETRIEVING_TENANT_PRIVATE_KEY( + "IKSR-10003", "Error retrieving tenant private key.", + "Error occurred when retrieving private key for tenant: %s."), + ERROR_CODE_ERROR_RETRIEVING_CUSTOM_PRIVATE_KEY( + "IKSR-10004", "Error retrieving custom keystore private key.", + "Error occurred when retrieving private key from key store: %s."), + ERROR_CODE_ERROR_RETRIEVING_TENANT_PUBLIC_CERTIFICATE( + "IKSR-10005", "Error retrieving tenant public certificate.", + "Error occurred when retrieving public certificate for tenant: %s."), + ERROR_CODE_ERROR_RETRIEVING_CUSTOM_PUBLIC_CERTIFICATE( + "IKSR-10006", "Error retrieving custom keystore public certificate.", + "Error occurred when retrieving public certificate from key store: %s."), + ERROR_CODE_ERROR_RETRIEVING_PRIMARY_KEYSTORE_CONFIGURATION( + "IKSR-10007", "Error retrieving primary keystore configuration.", + "Error occurred when retrieving primary keystore configuration."), + ERROR_CODE_ERROR_RETRIEVING_TENANT_KEYSTORE_CONFIGURATION( + "IKSR-10008", "Error retrieving tenant keystore configuration.", + "Error occurred when retrieving tenant keystore configuration for tenant: %s."), + ERROR_CODE_ERROR_RETRIEVING_CUSTOM_KEYSTORE_CONFIGURATION( + "IKSR-10009", "Error retrieving custom keystore configuration.", + "Error occurred when retrieving custom keystore configuration for: %s."), + + // Errors occurred within the IdentityKeyStoreResolver + ERROR_CODE_INVALID_ARGUMENT( + "IKSR-20001", "Illegal arguments provided.", + "%s must not be null or empty."); + + private final String code; + private final String message; + private final String description; + + ErrorMessages(String code, String message, String description) { + this.code = code; + this.message = message; + this.description = description; + } + + public String getCode() { + return code; + } + + public String getMessage() { + return message; + } + + public String getDescription() { + return description; + } + + @Override + public String toString() { + return code + " - " + message; + } + } +} diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverException.java b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverException.java new file mode 100644 index 000000000000..7256f4884b29 --- /dev/null +++ b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverException.java @@ -0,0 +1,37 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.core.util; + +import org.wso2.carbon.identity.base.IdentityException; + +/** + * Exception type for IdentityKeyStoreManager class. + */ +public class IdentityKeyStoreResolverException extends IdentityException { + + public IdentityKeyStoreResolverException(String errorCode, String message) { + + super(errorCode, message); + } + + public IdentityKeyStoreResolverException(String errorCode, String message, Throwable e) { + + super(errorCode, message, e); + } +} diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverUtil.java b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverUtil.java new file mode 100644 index 000000000000..98295af64c9b --- /dev/null +++ b/components/identity-core/org.wso2.carbon.identity.core/src/main/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverUtil.java @@ -0,0 +1,77 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.core.util; + +import org.apache.commons.lang.StringUtils; +import org.wso2.carbon.core.RegistryResources; +import org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverConstants.ErrorMessages; + +import javax.xml.namespace.QName; + +/** + * Utility methods for IdentityKeyStoreManager. + */ +public class IdentityKeyStoreResolverUtil { + + /** + * Builds the key store name for a tenant using tenant domain name. + * + * @param tenantDomain Tenant domain name. + * @return tenant key store name as String. + * @throws IdentityKeyStoreResolverException if tenant domain is null or empty. + */ + public static String buildTenantKeyStoreName(String tenantDomain) throws IdentityKeyStoreResolverException { + + if (StringUtils.isEmpty(tenantDomain)) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "Tenant domain")); + } + String ksName = tenantDomain.trim().replace(".", "-"); + return ksName + IdentityKeyStoreResolverConstants.KEY_STORE_EXTENSION; + } + + /** + * Builds the custom key store name by adding the CUSTOM_KEYSTORE_PREFIX to the key store name. + * + * @param keyStoreName Key store file name. + * @return Custom key store name as String. + * @throws IdentityKeyStoreResolverException if key store name is null or empty. + */ + public static String buildCustomKeyStoreName(String keyStoreName) throws IdentityKeyStoreResolverException { + + if (StringUtils.isEmpty(keyStoreName)) { + throw new IdentityKeyStoreResolverException( + ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getCode(), + String.format(ErrorMessages.ERROR_CODE_INVALID_ARGUMENT.getDescription(), "KeyStore name")); + } + return RegistryResources.SecurityManagement.CustomKeyStore.CUSTOM_KEYSTORE_PREFIX + keyStoreName; + } + + /** + * Builds a QName object with the IDENTITY_DEFAULT_NAMESPACE. + * + * @param localPart Local part of the QName. + * @return QName object. + */ + public static QName getQNameWithIdentityNameSpace(String localPart) { + + return new QName(IdentityCoreConstants.IDENTITY_DEFAULT_NAMESPACE, localPart); + } +} diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/test/java/org/wso2/carbon/identity/core/IdentityKeyStoreResolverTest.java b/components/identity-core/org.wso2.carbon.identity.core/src/test/java/org/wso2/carbon/identity/core/IdentityKeyStoreResolverTest.java new file mode 100644 index 000000000000..82d1388a8e7e --- /dev/null +++ b/components/identity-core/org.wso2.carbon.identity.core/src/test/java/org/wso2/carbon/identity/core/IdentityKeyStoreResolverTest.java @@ -0,0 +1,265 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.core; + +import junit.framework.TestCase; +import org.apache.axiom.om.OMElement; +import org.mockito.Mock; +import org.mockito.MockedStatic; +import org.testng.annotations.*; +import org.wso2.carbon.base.CarbonBaseConstants; +import org.wso2.carbon.core.util.KeyStoreManager; +import org.wso2.carbon.identity.core.model.IdentityKeyStoreMapping; +import org.wso2.carbon.identity.core.util.IdentityConfigParser; +import org.wso2.carbon.identity.core.util.IdentityTenantUtil; +import org.wso2.carbon.utils.ServerConstants; +import org.wso2.carbon.utils.multitenancy.MultitenantConstants; + +import java.io.FileInputStream; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.security.Key; +import java.security.KeyStore; +import java.security.cert.Certificate; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; +import static org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverConstants.*; + +/** + * Test cases for IdentityKeyStoreResolver. + */ +public class IdentityKeyStoreResolverTest extends TestCase { + + private static final String PRIMARY_KEY_STORE = "wso2carbon.jks"; + private static final String PRIMARY_KEY_STORE_PASSWORD = "wso2carbon"; + private static final String PRIMARY_KEY_STORE_ALIAS = "wso2carbon"; + + private static final String TENANT_KEY_STORE = "foo-com.jks"; + private static final String TENANT_KEY_STORE_PASSWORD = "foo.com"; + private static final String TENANT_KEY_STORE_ALIAS = "foo.com"; + + private static final String CUSTOM_KEY_STORE = "custom.jks"; + private static final String CUSTOM_KEY_STORE_PASSWORD = "custom"; + private static final String CUSTOM_KEY_STORE_ALIAS = "custom"; + + private static final String SUPER_TENANT_DOMAIN = MultitenantConstants.SUPER_TENANT_DOMAIN_NAME; + private static final String SUPER_TENANT_ID = "-1234"; + private static final String TENANT_DOMAIN = "foo.com"; + private static final String TENANT_ID = "1"; + + private KeyStore primaryKeyStore; + private KeyStore tenantKeyStore; + private KeyStore customKeyStore; + + private static Key primaryKey; + private static Key tenantKey; + private static Key customKey; + + private static Certificate primaryCertificate; + private static Certificate tenantCertificate; + private static Certificate customCertificate; + + @Mock + private IdentityConfigParser mockIdentityConfigParser; + + @Mock + private OMElement mockConfig; + + private IdentityKeyStoreResolver identityKeyStoreResolver; + + // Test key store mappings. + Map keyStoreMappings = new ConcurrentHashMap<>(); + + private MockedStatic identityConfigParser; + private MockedStatic identityTenantUtil; + + @BeforeClass + public void setUp() throws Exception { + + // Use identity.xml file from test resources. + String identityXmlPath = Paths.get(System.getProperty("user.dir"), "src", "test", "resources", + "identity.xml").toString(); + System.setProperty(ServerConstants.CARBON_HOME, "."); + mockIdentityConfigParser = IdentityConfigParser.getInstance(identityXmlPath); + + // Mock IdentityConfigParser. + identityConfigParser = mockStatic(IdentityConfigParser.class); + identityConfigParser.when(IdentityConfigParser::getInstance).thenReturn(mockIdentityConfigParser); + + identityTenantUtil = mockStatic(IdentityTenantUtil.class); + identityTenantUtil.when(() -> IdentityTenantUtil.getTenantId(SUPER_TENANT_DOMAIN)).thenReturn(Integer.valueOf(SUPER_TENANT_ID)); + identityTenantUtil.when(() -> IdentityTenantUtil.getTenantId(TENANT_DOMAIN)).thenReturn(Integer.valueOf(TENANT_ID)); + + identityKeyStoreResolver = IdentityKeyStoreResolver.getInstance(); + + // Mock getKeyStore method of key store manager. + System.setProperty(CarbonBaseConstants.CARBON_HOME, + Paths.get(System.getProperty("user.dir"), "src", "test", "resources").toString()); + + primaryKeyStore = getKeyStoreFromFile(PRIMARY_KEY_STORE, PRIMARY_KEY_STORE_PASSWORD, + System.getProperty(CarbonBaseConstants.CARBON_HOME)); + tenantKeyStore = getKeyStoreFromFile(TENANT_KEY_STORE, TENANT_KEY_STORE_PASSWORD, + System.getProperty(CarbonBaseConstants.CARBON_HOME)); + customKeyStore = getKeyStoreFromFile(CUSTOM_KEY_STORE, CUSTOM_KEY_STORE_PASSWORD, + System.getProperty(CarbonBaseConstants.CARBON_HOME)); + + KeyStoreManager keyStoreManager = mock(KeyStoreManager.class); + ConcurrentHashMap mtKeyStoreManagers = new ConcurrentHashMap(); + + mtKeyStoreManagers.put(SUPER_TENANT_ID, keyStoreManager); + mtKeyStoreManagers.put(TENANT_ID, keyStoreManager); + setPrivateStaticField(KeyStoreManager.class, "mtKeyStoreManagers", mtKeyStoreManagers); + + when(keyStoreManager.getPrimaryKeyStore()).thenReturn(primaryKeyStore); + when(keyStoreManager.getKeyStore(TENANT_KEY_STORE)).thenReturn(tenantKeyStore); + when(keyStoreManager.getKeyStore("CUSTOM/" + CUSTOM_KEY_STORE)).thenReturn(customKeyStore); + + // Mock set private keys. + primaryKey = getKeyStoreFromFile(PRIMARY_KEY_STORE, PRIMARY_KEY_STORE_PASSWORD, + System.getProperty(CarbonBaseConstants.CARBON_HOME)).getKey(PRIMARY_KEY_STORE_ALIAS, PRIMARY_KEY_STORE_PASSWORD.toCharArray()); + tenantKey = getKeyStoreFromFile(TENANT_KEY_STORE, TENANT_KEY_STORE_PASSWORD, + System.getProperty(CarbonBaseConstants.CARBON_HOME)).getKey(TENANT_KEY_STORE_ALIAS, TENANT_KEY_STORE_PASSWORD.toCharArray()); + customKey = getKeyStoreFromFile(CUSTOM_KEY_STORE, CUSTOM_KEY_STORE_PASSWORD, + System.getProperty(CarbonBaseConstants.CARBON_HOME)).getKey(CUSTOM_KEY_STORE_ALIAS, CUSTOM_KEY_STORE_PASSWORD.toCharArray()); + + Map privateKeys = new ConcurrentHashMap<>(); + privateKeys.put(SUPER_TENANT_ID, primaryKey); + privateKeys.put(TENANT_ID, tenantKey); + privateKeys.put(InboundProtocol.OAUTH.toString(), customKey); + privateKeys.put(InboundProtocol.WS_TRUST.toString(), customKey); + + setPrivateStaticField(IdentityKeyStoreResolver.class, "privateKeys", privateKeys); + + // Mock set certificates. + primaryCertificate = getKeyStoreFromFile(PRIMARY_KEY_STORE, PRIMARY_KEY_STORE_PASSWORD, + System.getProperty(CarbonBaseConstants.CARBON_HOME)).getCertificate(PRIMARY_KEY_STORE_ALIAS); + tenantCertificate = getKeyStoreFromFile(TENANT_KEY_STORE, TENANT_KEY_STORE_PASSWORD, + System.getProperty(CarbonBaseConstants.CARBON_HOME)).getCertificate(TENANT_KEY_STORE_ALIAS); + customCertificate = getKeyStoreFromFile(CUSTOM_KEY_STORE, CUSTOM_KEY_STORE_PASSWORD, + System.getProperty(CarbonBaseConstants.CARBON_HOME)).getCertificate(CUSTOM_KEY_STORE_ALIAS); + + Map publicCerts = new ConcurrentHashMap<>(); + publicCerts.put(SUPER_TENANT_ID, primaryCertificate); + publicCerts.put(TENANT_ID, tenantCertificate); + publicCerts.put(InboundProtocol.OAUTH.toString(), customCertificate); + publicCerts.put(InboundProtocol.WS_TRUST.toString(), customCertificate); + + setPrivateStaticField(IdentityKeyStoreResolver.class, "publicCerts", publicCerts); + } + + @AfterClass + public void close() { + + identityConfigParser.close(); + identityTenantUtil.close(); + } + + @Test + public void testGetInstance() { + + // Test for singleton instance. + IdentityKeyStoreResolver identityKeyStoreResolver1 = IdentityKeyStoreResolver.getInstance(); + IdentityKeyStoreResolver identityKeyStoreResolver2 = IdentityKeyStoreResolver.getInstance(); + assertEquals(identityKeyStoreResolver1, identityKeyStoreResolver2); + } + + @DataProvider(name = "KeyStoreDataProvider") + public Object[][] keyStoreDataProvider() { + + return new Object[][] { + {SUPER_TENANT_DOMAIN, InboundProtocol.WS_FEDERATION, primaryKeyStore}, + {TENANT_DOMAIN, InboundProtocol.WS_FEDERATION, tenantKeyStore}, + {SUPER_TENANT_DOMAIN, InboundProtocol.OAUTH, customKeyStore}, + {TENANT_DOMAIN, InboundProtocol.OAUTH, customKeyStore}, + {SUPER_TENANT_DOMAIN, InboundProtocol.WS_TRUST, customKeyStore}, + {TENANT_DOMAIN, InboundProtocol.WS_TRUST, tenantKeyStore} + }; + } + + @Test(dataProvider = "KeyStoreDataProvider") + public void testGetKeyStore(String tenantDomain, InboundProtocol inboundProtocol, KeyStore expectedKeyStore) throws Exception { + + assertEquals(expectedKeyStore, identityKeyStoreResolver.getKeyStore(tenantDomain, inboundProtocol)); + } + + @DataProvider(name = "PrivateKeyDataProvider") + public Object[][] privateKeyDataProvider() { + + return new Object[][] { + {SUPER_TENANT_DOMAIN, InboundProtocol.WS_FEDERATION, primaryKey}, + {TENANT_DOMAIN, InboundProtocol.WS_FEDERATION, tenantKey}, + {SUPER_TENANT_DOMAIN, InboundProtocol.OAUTH, customKey}, + {TENANT_DOMAIN, InboundProtocol.OAUTH, customKey}, + {SUPER_TENANT_DOMAIN, InboundProtocol.WS_TRUST, customKey}, + {TENANT_DOMAIN, InboundProtocol.WS_TRUST, tenantKey} + }; + } + + @Test(dataProvider = "PrivateKeyDataProvider") + public void testGetPrivateKey(String tenantDomain, InboundProtocol inboundProtocol, Key expectedKey) throws Exception { + + assertEquals(expectedKey, identityKeyStoreResolver.getPrivateKey(tenantDomain, inboundProtocol)); + } + + @DataProvider(name = "PublicCertificateDataProvider") + public Object[][] publicCertificateDataProvider() { + + return new Object[][] { + {SUPER_TENANT_DOMAIN, InboundProtocol.WS_FEDERATION, primaryCertificate}, + {TENANT_DOMAIN, InboundProtocol.WS_FEDERATION, tenantCertificate}, + {SUPER_TENANT_DOMAIN, InboundProtocol.OAUTH, customCertificate}, + {TENANT_DOMAIN, InboundProtocol.OAUTH, customCertificate}, + {SUPER_TENANT_DOMAIN, InboundProtocol.WS_TRUST, customCertificate}, + {TENANT_DOMAIN, InboundProtocol.WS_TRUST, tenantCertificate} + }; + } + + @Test(dataProvider = "PublicCertificateDataProvider") + public void testGetCertificate(String tenantDomain, InboundProtocol inboundProtocol, Certificate expectedCert) throws Exception { + + assertEquals(expectedCert, identityKeyStoreResolver.getCertificate(tenantDomain, inboundProtocol)); + } + + private KeyStore getKeyStoreFromFile(String keystoreName, String password, String home) throws Exception { + + Path tenantKeystorePath = Paths.get(home, "repository", "resources", "security", keystoreName); + FileInputStream file = new FileInputStream(tenantKeystorePath.toString()); + KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); + keystore.load(file, password.toCharArray()); + return keystore; + } + + private void setPrivateStaticField(Class clazz, String fieldName, Object newValue) + throws NoSuchFieldException, IllegalAccessException { + + Field field = clazz.getDeclaredField(fieldName); + field.setAccessible(true); + field.set(null, newValue); + } + +} diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/test/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverUtilTest.java b/components/identity-core/org.wso2.carbon.identity.core/src/test/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverUtilTest.java new file mode 100644 index 000000000000..0a3d7eb3faf1 --- /dev/null +++ b/components/identity-core/org.wso2.carbon.identity.core/src/test/java/org/wso2/carbon/identity/core/util/IdentityKeyStoreResolverUtilTest.java @@ -0,0 +1,104 @@ +/* + * 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 + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.identity.core.util; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static org.testng.Assert.assertEquals; + +import static org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverUtil.buildCustomKeyStoreName; +import static org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverUtil.buildTenantKeyStoreName; +import static org.wso2.carbon.identity.core.util.IdentityKeyStoreResolverUtil.getQNameWithIdentityNameSpace; + +import javax.xml.namespace.QName; + +/** + * Test cases for IdentityKeyStoreResolverUtil. + */ +public class IdentityKeyStoreResolverUtilTest { + + @DataProvider(name = "CorrectTenantKeyStoreNameDataProvider") + public Object[][] correctTenantKeyStoreNameDataProvider() { + + return new Object[][] { + {"example", "example.jks"}, + {"example.com", "example-com.jks"} + }; + } + + @Test(dataProvider = "CorrectTenantKeyStoreNameDataProvider") + public void testCorrectBuildTenantKeyStoreName(String tenantDomain, String expectedResult) throws IdentityKeyStoreResolverException { + + assertEquals(expectedResult, buildTenantKeyStoreName(tenantDomain)); + } + + @DataProvider(name = "IncorrectTenantKeyStoreNameDataProvider") + public Object[] incorrectTenantKeyStoreNameDataProvider() { + + return new Object[] { + "", + null + }; + } + + @Test(dataProvider = "IncorrectTenantKeyStoreNameDataProvider", expectedExceptions = IdentityKeyStoreResolverException.class) + public void testIncorrectBuildTenantKeyStoreName(String tenantDomain) throws IdentityKeyStoreResolverException { + + buildTenantKeyStoreName(tenantDomain); + } + + @DataProvider(name = "CorrectCustomKeyStoreNameDataProvider") + public Object[][] correctCustomKeyStoreNameDataProvider() { + + return new Object[][] { + {"example.jks", "CUSTOM/example.jks"}, + {"k$ySt&re.jks", "CUSTOM/k$ySt&re.jks"} + }; + } + + @Test(dataProvider = "CorrectCustomKeyStoreNameDataProvider") + public void testCorrectBuildCustomKeyStoreName(String keyStoreName, String expectedResult) throws IdentityKeyStoreResolverException { + + assertEquals(expectedResult, buildCustomKeyStoreName(keyStoreName)); + } + + @DataProvider(name = "IncorrectCustomKeyStoreNameDataProvider") + public Object[] incorrectCustomKeyStoreNameDataProvider() { + + return new Object[] { + "", + null + }; + } + + @Test(dataProvider = "IncorrectCustomKeyStoreNameDataProvider", expectedExceptions = IdentityKeyStoreResolverException.class) + public void testIncorrectBuildCustomKeyStoreName(String keyStoreName) throws IdentityKeyStoreResolverException { + + buildCustomKeyStoreName(keyStoreName); + } + + @Test + public void testGetQNameWithIdentityNameSpace() { + + QName qName = getQNameWithIdentityNameSpace("localPart"); + assertEquals(IdentityCoreConstants.IDENTITY_DEFAULT_NAMESPACE, qName.getNamespaceURI()); + assertEquals("localPart", qName.getLocalPart()); + } +} diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/identity.xml b/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/identity.xml index addd017fa1d4..79b52c5aeb70 100644 --- a/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/identity.xml +++ b/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/identity.xml @@ -48,6 +48,21 @@ ${carbon.home}/conf/keystores SunX509 SunX509 + + + + custom.jks + true + + + custom.jks + + + + + true + + diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/repository/resources/security/custom.jks b/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/repository/resources/security/custom.jks new file mode 100644 index 000000000000..bb17115d758d Binary files /dev/null and b/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/repository/resources/security/custom.jks differ diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/repository/resources/security/foo-com.jks b/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/repository/resources/security/foo-com.jks new file mode 100644 index 000000000000..1c3eb532cec7 Binary files /dev/null and b/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/repository/resources/security/foo-com.jks differ diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/repository/resources/security/wso2carbon.jks b/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/repository/resources/security/wso2carbon.jks new file mode 100644 index 000000000000..a16b35fef09c Binary files /dev/null and b/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/repository/resources/security/wso2carbon.jks differ diff --git a/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/testng.xml b/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/testng.xml index fd8647eacacb..043fa43d7ae7 100644 --- a/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/testng.xml +++ b/components/identity-core/org.wso2.carbon.identity.core/src/test/resources/testng.xml @@ -28,6 +28,8 @@ + + diff --git a/components/identity-core/pom.xml b/components/identity-core/pom.xml index b29ef6f04e10..7ada8b731bdf 100644 --- a/components/identity-core/pom.xml +++ b/components/identity-core/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/identity-event/org.wso2.carbon.identity.event/pom.xml b/components/identity-event/org.wso2.carbon.identity.event/pom.xml index b9f925d37898..8f61b49213a3 100644 --- a/components/identity-event/org.wso2.carbon.identity.event/pom.xml +++ b/components/identity-event/org.wso2.carbon.identity.event/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-event - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/identity-event/pom.xml b/components/identity-event/pom.xml index de9bc6c66b47..9c8964ea86d5 100644 --- a/components/identity-event/pom.xml +++ b/components/identity-event/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/identity-mgt/org.wso2.carbon.identity.mgt.endpoint.util/pom.xml b/components/identity-mgt/org.wso2.carbon.identity.mgt.endpoint.util/pom.xml index 375b8e001f74..a5a49b4e9806 100644 --- a/components/identity-mgt/org.wso2.carbon.identity.mgt.endpoint.util/pom.xml +++ b/components/identity-mgt/org.wso2.carbon.identity.mgt.endpoint.util/pom.xml @@ -1,13 +1,13 @@ + ${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-exports java.base/jdk.internal.loader=ALL-UNNAMED @@ -242,7 +244,7 @@ COMPLEXITY COVEREDRATIO - 0.37 + 0.36 diff --git a/components/idp-mgt/pom.xml b/components/idp-mgt/pom.xml index 88c18b027681..f6635d866dc4 100644 --- a/components/idp-mgt/pom.xml +++ b/components/idp-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/input-validation-mgt/org.wso2.carbon.identity.input.validation.mgt/pom.xml b/components/input-validation-mgt/org.wso2.carbon.identity.input.validation.mgt/pom.xml index 41144020ddcf..f5cdf5bab206 100644 --- a/components/input-validation-mgt/org.wso2.carbon.identity.input.validation.mgt/pom.xml +++ b/components/input-validation-mgt/org.wso2.carbon.identity.input.validation.mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework input-validation-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -114,6 +114,73 @@ + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/input-validation-mgt/pom.xml b/components/input-validation-mgt/pom.xml index 8c5e6abfac5b..4d9d4bff103b 100644 --- a/components/input-validation-mgt/pom.xml +++ b/components/input-validation-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/multi-attribute-login/org.wso2.carbon.identity.multi.attribute.login.mgt/pom.xml b/components/multi-attribute-login/org.wso2.carbon.identity.multi.attribute.login.mgt/pom.xml index 8e5cb64cc714..9e9db1adba91 100644 --- a/components/multi-attribute-login/org.wso2.carbon.identity.multi.attribute.login.mgt/pom.xml +++ b/components/multi-attribute-login/org.wso2.carbon.identity.multi.attribute.login.mgt/pom.xml @@ -21,7 +21,7 @@ multi-attribute-login org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 @@ -108,7 +108,7 @@ org.jacoco jacoco-maven-plugin - ${jacoco.version} + ${jacoco.version} default-prepare-agent diff --git a/components/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt/pom.xml b/components/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt/pom.xml index 84c2b73f1fb4..ceeef83dcb9f 100644 --- a/components/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt/pom.xml +++ b/components/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt/pom.xml @@ -21,7 +21,7 @@ multi-attribute-login org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 @@ -51,6 +51,11 @@ org.wso2.carbon.identity.framework org.wso2.carbon.identity.claim.metadata.mgt + + org.testng + testng + test + @@ -81,6 +86,73 @@ + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt/src/test/resources/testng.xml b/components/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt/src/test/resources/testng.xml new file mode 100644 index 000000000000..e9122c496420 --- /dev/null +++ b/components/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/multi-attribute-login/pom.xml b/components/multi-attribute-login/pom.xml index 037aa83be9a9..57954ad3dc6b 100644 --- a/components/multi-attribute-login/pom.xml +++ b/components/multi-attribute-login/pom.xml @@ -21,7 +21,7 @@ identity-framework org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/pom.xml b/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/pom.xml index 14e3c75c5d92..f11624220953 100644 --- a/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/pom.xml +++ b/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.identity.framework notification-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -57,6 +57,11 @@ org.wso2.carbon.identity.framework org.wso2.carbon.identity.base + + org.testng + testng + test + @@ -102,6 +107,73 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/src/test/resources/testng.xml b/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/src/test/resources/testng.xml new file mode 100644 index 000000000000..b9bb6baa2839 --- /dev/null +++ b/components/notification-mgt/org.wso2.carbon.identity.notification.mgt/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/notification-mgt/pom.xml b/components/notification-mgt/pom.xml index 0a5eb7133895..a1f1398d83af 100644 --- a/components/notification-mgt/pom.xml +++ b/components/notification-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/policy-editor/org.wso2.carbon.policyeditor.ui/pom.xml b/components/policy-editor/org.wso2.carbon.policyeditor.ui/pom.xml index 3bbd938400d7..84ea95c91ca3 100644 --- a/components/policy-editor/org.wso2.carbon.policyeditor.ui/pom.xml +++ b/components/policy-editor/org.wso2.carbon.policyeditor.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework policy-editor - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/policy-editor/org.wso2.carbon.policyeditor/pom.xml b/components/policy-editor/org.wso2.carbon.policyeditor/pom.xml index 99b2292b51b7..fe822d83df21 100644 --- a/components/policy-editor/org.wso2.carbon.policyeditor/pom.xml +++ b/components/policy-editor/org.wso2.carbon.policyeditor/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework policy-editor - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -44,6 +44,11 @@ org.wso2.carbon.identity.framework org.wso2.carbon.identity.core + + org.testng + testng + test + @@ -82,6 +87,73 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/policy-editor/org.wso2.carbon.policyeditor/src/test/resources/testng.xml b/components/policy-editor/org.wso2.carbon.policyeditor/src/test/resources/testng.xml new file mode 100644 index 000000000000..dbcb55db7ae3 --- /dev/null +++ b/components/policy-editor/org.wso2.carbon.policyeditor/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/policy-editor/pom.xml b/components/policy-editor/pom.xml index 93ccccd8ba27..f4eb36bf3844 100644 --- a/components/policy-editor/pom.xml +++ b/components/policy-editor/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/provisioning/org.wso2.carbon.identity.provisioning/pom.xml b/components/provisioning/org.wso2.carbon.identity.provisioning/pom.xml index a960ce237e49..8ce827964f1b 100644 --- a/components/provisioning/org.wso2.carbon.identity.provisioning/pom.xml +++ b/components/provisioning/org.wso2.carbon.identity.provisioning/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework provisioning - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -176,7 +176,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.xml/jdk.xml.internal=ALL-UNNAMED diff --git a/components/provisioning/pom.xml b/components/provisioning/pom.xml index 2d7c9e4f5dc5..6c19e1a16307 100644 --- a/components/provisioning/pom.xml +++ b/components/provisioning/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/role-mgt/org.wso2.carbon.identity.role.mgt.core/pom.xml b/components/role-mgt/org.wso2.carbon.identity.role.mgt.core/pom.xml index efc8fbb712fa..c2e6c3d55de7 100644 --- a/components/role-mgt/org.wso2.carbon.identity.role.mgt.core/pom.xml +++ b/components/role-mgt/org.wso2.carbon.identity.role.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework role-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/role-mgt/org.wso2.carbon.identity.role.v2.mgt.core/pom.xml b/components/role-mgt/org.wso2.carbon.identity.role.v2.mgt.core/pom.xml index 407d41e7587b..ca8b0e13e159 100644 --- a/components/role-mgt/org.wso2.carbon.identity.role.v2.mgt.core/pom.xml +++ b/components/role-mgt/org.wso2.carbon.identity.role.v2.mgt.core/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework role-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/role-mgt/pom.xml b/components/role-mgt/pom.xml index d4dfdae990f2..eb44263e40ab 100644 --- a/components/role-mgt/pom.xml +++ b/components/role-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/secret-mgt/org.wso2.carbon.identity.secret.mgt.core/pom.xml b/components/secret-mgt/org.wso2.carbon.identity.secret.mgt.core/pom.xml index 4360de15f786..619a0cde14b9 100644 --- a/components/secret-mgt/org.wso2.carbon.identity.secret.mgt.core/pom.xml +++ b/components/secret-mgt/org.wso2.carbon.identity.secret.mgt.core/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.identity.framework secret-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT 4.0.0 @@ -152,7 +152,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens=java.base/sun.nio.fs=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED diff --git a/components/secret-mgt/pom.xml b/components/secret-mgt/pom.xml index 79021397d23c..4887dc578415 100644 --- a/components/secret-mgt/pom.xml +++ b/components/secret-mgt/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/security-mgt/org.wso2.carbon.security.mgt.ui/pom.xml b/components/security-mgt/org.wso2.carbon.security.mgt.ui/pom.xml index e33814f0faf4..b4927dc5b1a9 100644 --- a/components/security-mgt/org.wso2.carbon.security.mgt.ui/pom.xml +++ b/components/security-mgt/org.wso2.carbon.security.mgt.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework security-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/security-mgt/org.wso2.carbon.security.mgt/pom.xml b/components/security-mgt/org.wso2.carbon.security.mgt/pom.xml index 9ab5c90b0654..d558d483f35f 100644 --- a/components/security-mgt/org.wso2.carbon.security.mgt/pom.xml +++ b/components/security-mgt/org.wso2.carbon.security.mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework security-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/security-mgt/pom.xml b/components/security-mgt/pom.xml index d8b377552470..91fd8246bb17 100644 --- a/components/security-mgt/pom.xml +++ b/components/security-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/template-mgt/org.wso2.carbon.identity.template.mgt.ui/pom.xml b/components/template-mgt/org.wso2.carbon.identity.template.mgt.ui/pom.xml index 307302debc57..fac03d95471a 100644 --- a/components/template-mgt/org.wso2.carbon.identity.template.mgt.ui/pom.xml +++ b/components/template-mgt/org.wso2.carbon.identity.template.mgt.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework template-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/components/template-mgt/org.wso2.carbon.identity.template.mgt/pom.xml b/components/template-mgt/org.wso2.carbon.identity.template.mgt/pom.xml index edf87009cb00..59a0d8b6c8a7 100644 --- a/components/template-mgt/org.wso2.carbon.identity.template.mgt/pom.xml +++ b/components/template-mgt/org.wso2.carbon.identity.template.mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework template-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 @@ -58,7 +58,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.xml/jdk.xml.internal=ALL-UNNAMED diff --git a/components/template-mgt/pom.xml b/components/template-mgt/pom.xml index 9b684c8b739b..0724d2be048b 100644 --- a/components/template-mgt/pom.xml +++ b/components/template-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/trusted-app-mgt/org.wso2.carbon.identity.trusted.app.mgt/pom.xml b/components/trusted-app-mgt/org.wso2.carbon.identity.trusted.app.mgt/pom.xml index a2a86d6309a7..032a7656fa70 100644 --- a/components/trusted-app-mgt/org.wso2.carbon.identity.trusted.app.mgt/pom.xml +++ b/components/trusted-app-mgt/org.wso2.carbon.identity.trusted.app.mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework trusted-app-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -100,7 +100,9 @@ maven-surefire-plugin ${maven.surefire.plugin.version} + + ${argLine} --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED --add-exports java.base/jdk.internal.loader=ALL-UNNAMED @@ -151,7 +153,7 @@ COMPLEXITY COVEREDRATIO - 0.90 + 0.34 diff --git a/components/trusted-app-mgt/pom.xml b/components/trusted-app-mgt/pom.xml index 179c7435571c..0131eda927cb 100644 --- a/components/trusted-app-mgt/pom.xml +++ b/components/trusted-app-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt/pom.xml b/components/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt/pom.xml index 159c1e779c3b..1786c2bdc3a9 100644 --- a/components/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt/pom.xml +++ b/components/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt/pom.xml @@ -21,7 +21,7 @@ user-functionality-mgt org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT 4.0.0 @@ -71,7 +71,9 @@ org.apache.maven.plugins maven-surefire-plugin + + ${argLine} --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED diff --git a/components/user-functionality-mgt/pom.xml b/components/user-functionality-mgt/pom.xml index 36fc55025358..851c6375e24e 100644 --- a/components/user-functionality-mgt/pom.xml +++ b/components/user-functionality-mgt/pom.xml @@ -21,7 +21,7 @@ identity-framework org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/user-mgt/org.wso2.carbon.identity.user.profile.ui/pom.xml b/components/user-mgt/org.wso2.carbon.identity.user.profile.ui/pom.xml index 1e56ba6f95c2..65e7e991c7f0 100644 --- a/components/user-mgt/org.wso2.carbon.identity.user.profile.ui/pom.xml +++ b/components/user-mgt/org.wso2.carbon.identity.user.profile.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/user-mgt/org.wso2.carbon.identity.user.profile/pom.xml b/components/user-mgt/org.wso2.carbon.identity.user.profile/pom.xml index 505349a28c1c..c1fcc98704b6 100644 --- a/components/user-mgt/org.wso2.carbon.identity.user.profile/pom.xml +++ b/components/user-mgt/org.wso2.carbon.identity.user.profile/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/user-mgt/org.wso2.carbon.identity.user.registration/pom.xml b/components/user-mgt/org.wso2.carbon.identity.user.registration/pom.xml index 535f5715c1e7..a30a7fc45184 100644 --- a/components/user-mgt/org.wso2.carbon.identity.user.registration/pom.xml +++ b/components/user-mgt/org.wso2.carbon.identity.user.registration/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/user-mgt/org.wso2.carbon.role.mgt.ui/pom.xml b/components/user-mgt/org.wso2.carbon.role.mgt.ui/pom.xml index c86f5e27311b..49a1e9d9b6b5 100644 --- a/components/user-mgt/org.wso2.carbon.role.mgt.ui/pom.xml +++ b/components/user-mgt/org.wso2.carbon.role.mgt.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/user-mgt/org.wso2.carbon.user.mgt.common/pom.xml b/components/user-mgt/org.wso2.carbon.user.mgt.common/pom.xml index 4c08824198a3..ba47817b9b1f 100644 --- a/components/user-mgt/org.wso2.carbon.user.mgt.common/pom.xml +++ b/components/user-mgt/org.wso2.carbon.user.mgt.common/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/user-mgt/org.wso2.carbon.user.mgt.ui/pom.xml b/components/user-mgt/org.wso2.carbon.user.mgt.ui/pom.xml index 6bd370c4e09a..b99c02eb1ca0 100644 --- a/components/user-mgt/org.wso2.carbon.user.mgt.ui/pom.xml +++ b/components/user-mgt/org.wso2.carbon.user.mgt.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/user-mgt/org.wso2.carbon.user.mgt/pom.xml b/components/user-mgt/org.wso2.carbon.user.mgt/pom.xml index d7fc82bff98c..888193d64c5f 100644 --- a/components/user-mgt/org.wso2.carbon.user.mgt/pom.xml +++ b/components/user-mgt/org.wso2.carbon.user.mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/user-mgt/pom.xml b/components/user-mgt/pom.xml index 8648954eeff9..d15493e2d68a 100644 --- a/components/user-mgt/pom.xml +++ b/components/user-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/pom.xml b/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/pom.xml index 274a4181f50a..0542ecf8e896 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/pom.xml +++ b/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-store - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -59,6 +59,11 @@ junit test + + org.testng + testng + test + @@ -118,6 +123,73 @@ true + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/src/test/resources/testng.xml b/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/src/test/resources/testng.xml new file mode 100644 index 000000000000..55b527a929d2 --- /dev/null +++ b/components/user-store/org.wso2.carbon.identity.user.store.configuration.deployer/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/user-store/org.wso2.carbon.identity.user.store.configuration.ui/pom.xml b/components/user-store/org.wso2.carbon.identity.user.store.configuration.ui/pom.xml index b65908e56662..d1996fdd6a45 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.configuration.ui/pom.xml +++ b/components/user-store/org.wso2.carbon.identity.user.store.configuration.ui/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-store - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/components/user-store/org.wso2.carbon.identity.user.store.configuration.ui/src/main/resources/web/userstore_config/validateconnection-ajaxprocessor.jsp b/components/user-store/org.wso2.carbon.identity.user.store.configuration.ui/src/main/resources/web/userstore_config/validateconnection-ajaxprocessor.jsp index 897d25085105..0ceb701751a9 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.configuration.ui/src/main/resources/web/userstore_config/validateconnection-ajaxprocessor.jsp +++ b/components/user-store/org.wso2.carbon.identity.user.store.configuration.ui/src/main/resources/web/userstore_config/validateconnection-ajaxprocessor.jsp @@ -4,6 +4,7 @@ <%@ page import="org.wso2.carbon.identity.user.store.configuration.ui.client.UserStoreConfigAdminServiceClient" %> <%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %> <%@ page import="org.wso2.carbon.utils.ServerConstants" %> +<%@ page import="org.owasp.encoder.Encode" %> <% String domainName = request.getParameter("domainName"); String driverName = request.getParameter("driverName"); @@ -28,7 +29,7 @@ <%=canAdd%> <% } catch (Throwable e) { -%><%=e.getMessage()%><% +%><%=Encode.forHtml(e.getMessage())%><% } }else{ String errmsg = "Please specify a domain name"; diff --git a/components/user-store/org.wso2.carbon.identity.user.store.configuration/pom.xml b/components/user-store/org.wso2.carbon.identity.user.store.configuration/pom.xml index 29a7a3b5d200..12bd307a5819 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.configuration/pom.xml +++ b/components/user-store/org.wso2.carbon.identity.user.store.configuration/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-store - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -71,6 +71,12 @@ org.wso2.orbit.javax.xml.bind jaxb-api + + org.testng + testng + test + + @@ -133,6 +139,73 @@ + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/user-store/org.wso2.carbon.identity.user.store.configuration/src/test/resources/testng.xml b/components/user-store/org.wso2.carbon.identity.user.store.configuration/src/test/resources/testng.xml new file mode 100644 index 000000000000..3bc483ce01b7 --- /dev/null +++ b/components/user-store/org.wso2.carbon.identity.user.store.configuration/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/user-store/org.wso2.carbon.identity.user.store.count/pom.xml b/components/user-store/org.wso2.carbon.identity.user.store.count/pom.xml index 6804188f8694..58f671530b88 100644 --- a/components/user-store/org.wso2.carbon.identity.user.store.count/pom.xml +++ b/components/user-store/org.wso2.carbon.identity.user.store.count/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-store - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml @@ -50,6 +50,12 @@ org.wso2.carbon.identity.framework org.wso2.carbon.identity.core + + org.testng + testng + test + + @@ -99,7 +105,73 @@ - + + org.apache.maven.plugins + maven-surefire-plugin + ${maven.surefire.plugin.version} + + + + ${argLine} + --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED + --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED + + + src/test/resources/testng.xml + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + default-prepare-agent + + prepare-agent + + + + default-prepare-agent-integration + + prepare-agent-integration + + + + default-report + + report + + + + default-report-integration + + report-integration + + + + default-check + + check + + + + + BUNDLE + + + COMPLEXITY + COVEREDRATIO + + + + + + + + + com.github.spotbugs spotbugs-maven-plugin diff --git a/components/user-store/org.wso2.carbon.identity.user.store.count/src/test/resources/testng.xml b/components/user-store/org.wso2.carbon.identity.user.store.count/src/test/resources/testng.xml new file mode 100644 index 000000000000..75f265a7e167 --- /dev/null +++ b/components/user-store/org.wso2.carbon.identity.user.store.count/src/test/resources/testng.xml @@ -0,0 +1,26 @@ + + + + + + + + + + diff --git a/components/user-store/pom.xml b/components/user-store/pom.xml index 7a778869c20f..30e103958f06 100644 --- a/components/user-store/pom.xml +++ b/components/user-store/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/action-mgt/org.wso2.carbon.identity.action.management.server.feature/pom.xml b/features/action-mgt/org.wso2.carbon.identity.action.management.server.feature/pom.xml index b6e9f39f4954..aa0b06c873fa 100644 --- a/features/action-mgt/org.wso2.carbon.identity.action.management.server.feature/pom.xml +++ b/features/action-mgt/org.wso2.carbon.identity.action.management.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework action-management-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/action-mgt/pom.xml b/features/action-mgt/pom.xml index 7d0f0994ffa4..d8a6e2255f08 100644 --- a/features/action-mgt/pom.xml +++ b/features/action-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/pom.xml b/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/pom.xml index 688f6eb39eae..d9e446719336 100644 --- a/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/pom.xml +++ b/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework api-resource-management-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/resources/api-resource-collection.xml b/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/resources/api-resource-collection.xml index 9cdce3f2e982..5d1a6c001d28 100644 --- a/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/resources/api-resource-collection.xml +++ b/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/resources/api-resource-collection.xml @@ -298,6 +298,8 @@ + + diff --git a/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/resources/api-resource-collection.xml.j2 b/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/resources/api-resource-collection.xml.j2 index d667cba5fc97..1cbd3218137e 100644 --- a/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/resources/api-resource-collection.xml.j2 +++ b/features/api-resource-mgt/org.wso2.carbon.identity.api.resource.mgt.server.feature/resources/api-resource-collection.xml.j2 @@ -101,6 +101,7 @@ + @@ -331,6 +332,8 @@ + + @@ -753,6 +756,7 @@ + diff --git a/features/api-resource-mgt/pom.xml b/features/api-resource-mgt/pom.xml index 101c49003fc3..35b7a726e058 100644 --- a/features/api-resource-mgt/pom.xml +++ b/features/api-resource-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/application-mgt/org.wso2.carbon.identity.application.mgt.feature/pom.xml b/features/application-mgt/org.wso2.carbon.identity.application.mgt.feature/pom.xml index 69cf97a4d399..126b3db373f0 100644 --- a/features/application-mgt/org.wso2.carbon.identity.application.mgt.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.identity.application.mgt.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework application-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/application-mgt/org.wso2.carbon.identity.application.mgt.server.feature/pom.xml b/features/application-mgt/org.wso2.carbon.identity.application.mgt.server.feature/pom.xml index 3cf9fa0dc6c2..4049c9c1d06e 100644 --- a/features/application-mgt/org.wso2.carbon.identity.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.identity.application.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework application-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/application-mgt/org.wso2.carbon.identity.application.mgt.ui.feature/pom.xml b/features/application-mgt/org.wso2.carbon.identity.application.mgt.ui.feature/pom.xml index bd14bf6d9f07..7b5614554d2a 100644 --- a/features/application-mgt/org.wso2.carbon.identity.application.mgt.ui.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.identity.application.mgt.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework application-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index c98d96c10e56..03d6686e6e19 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/authentication-framework/org.wso2.carbon.identity.application.authentication.framework.server.feature/pom.xml b/features/authentication-framework/org.wso2.carbon.identity.application.authentication.framework.server.feature/pom.xml index f32289ebf867..af451b4754f7 100644 --- a/features/authentication-framework/org.wso2.carbon.identity.application.authentication.framework.server.feature/pom.xml +++ b/features/authentication-framework/org.wso2.carbon.identity.application.authentication.framework.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework authentication-framework-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/authentication-framework/pom.xml b/features/authentication-framework/pom.xml index cb7ce16e28da..1942415d2045 100644 --- a/features/authentication-framework/pom.xml +++ b/features/authentication-framework/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/carbon-authenticators/pom.xml b/features/carbon-authenticators/pom.xml index 7d3c9ef8f27e..431bfcddc9be 100644 --- a/features/carbon-authenticators/pom.xml +++ b/features/carbon-authenticators/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.thrift.authentication.feature/pom.xml b/features/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.thrift.authentication.feature/pom.xml index 45a8b9299263..24a84ec724b8 100644 --- a/features/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.thrift.authentication.feature/pom.xml +++ b/features/carbon-authenticators/thrift-authenticator/org.wso2.carbon.identity.thrift.authentication.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework thrift-authenticator-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/carbon-authenticators/thrift-authenticator/pom.xml b/features/carbon-authenticators/thrift-authenticator/pom.xml index a507960739f9..3272d24261cd 100644 --- a/features/carbon-authenticators/thrift-authenticator/pom.xml +++ b/features/carbon-authenticators/thrift-authenticator/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-authenticator-features - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/categories/authorization/pom.xml b/features/categories/authorization/pom.xml index 1bed6c35f830..ffaaa2055dbd 100644 --- a/features/categories/authorization/pom.xml +++ b/features/categories/authorization/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../../pom.xml diff --git a/features/categories/inbound-authentication/pom.xml b/features/categories/inbound-authentication/pom.xml index 0cfc183c54fe..140d3299b892 100644 --- a/features/categories/inbound-authentication/pom.xml +++ b/features/categories/inbound-authentication/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../../pom.xml diff --git a/features/categories/inbound-provisioning/pom.xml b/features/categories/inbound-provisioning/pom.xml index b6f20ce45a88..58466555f2ba 100644 --- a/features/categories/inbound-provisioning/pom.xml +++ b/features/categories/inbound-provisioning/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../../pom.xml diff --git a/features/categories/keystore-mgt/pom.xml b/features/categories/keystore-mgt/pom.xml index c767ba3f7744..f7e5efb6d9ff 100644 --- a/features/categories/keystore-mgt/pom.xml +++ b/features/categories/keystore-mgt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../../pom.xml diff --git a/features/categories/notification-mgt/pom.xml b/features/categories/notification-mgt/pom.xml index e9439e242751..9802f6c1f9cf 100644 --- a/features/categories/notification-mgt/pom.xml +++ b/features/categories/notification-mgt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../../pom.xml diff --git a/features/categories/outbound-authentication/pom.xml b/features/categories/outbound-authentication/pom.xml index ac47f528242d..b88c3063c6c3 100644 --- a/features/categories/outbound-authentication/pom.xml +++ b/features/categories/outbound-authentication/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../../pom.xml diff --git a/features/categories/outbound-provisioning/pom.xml b/features/categories/outbound-provisioning/pom.xml index 1ab93924b51c..c95f4ca69147 100644 --- a/features/categories/outbound-provisioning/pom.xml +++ b/features/categories/outbound-provisioning/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../../pom.xml diff --git a/features/categories/pom.xml b/features/categories/pom.xml index b9289e809bf5..21db6a2c090a 100644 --- a/features/categories/pom.xml +++ b/features/categories/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/categories/user-mgt/pom.xml b/features/categories/user-mgt/pom.xml index 0b59524d6443..3501ec3f8d76 100644 --- a/features/categories/user-mgt/pom.xml +++ b/features/categories/user-mgt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../../pom.xml diff --git a/features/central-logger/org.wso2.carbon.identity.central.log.mgt.server.feature/pom.xml b/features/central-logger/org.wso2.carbon.identity.central.log.mgt.server.feature/pom.xml index d7c35d62b0c0..5d7bf67e4da5 100644 --- a/features/central-logger/org.wso2.carbon.identity.central.log.mgt.server.feature/pom.xml +++ b/features/central-logger/org.wso2.carbon.identity.central.log.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework central-logger-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/central-logger/pom.xml b/features/central-logger/pom.xml index 71b98e1fdb83..2a0c77088ed5 100644 --- a/features/central-logger/pom.xml +++ b/features/central-logger/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/features/claim-mgt/org.wso2.carbon.claim.mgt.feature/pom.xml b/features/claim-mgt/org.wso2.carbon.claim.mgt.feature/pom.xml index 706eed1ef8ec..84f11eff5cb1 100644 --- a/features/claim-mgt/org.wso2.carbon.claim.mgt.feature/pom.xml +++ b/features/claim-mgt/org.wso2.carbon.claim.mgt.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework claim-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/claim-mgt/org.wso2.carbon.claim.mgt.server.feature/pom.xml b/features/claim-mgt/org.wso2.carbon.claim.mgt.server.feature/pom.xml index 4428e5dac4ee..235dfd8ee873 100644 --- a/features/claim-mgt/org.wso2.carbon.claim.mgt.server.feature/pom.xml +++ b/features/claim-mgt/org.wso2.carbon.claim.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework claim-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/claim-mgt/org.wso2.carbon.claim.mgt.ui.feature/pom.xml b/features/claim-mgt/org.wso2.carbon.claim.mgt.ui.feature/pom.xml index 277f938dc1cf..5f82def5e5ae 100644 --- a/features/claim-mgt/org.wso2.carbon.claim.mgt.ui.feature/pom.xml +++ b/features/claim-mgt/org.wso2.carbon.claim.mgt.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework claim-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/claim-mgt/pom.xml b/features/claim-mgt/pom.xml index 3c0030f076db..846434891814 100644 --- a/features/claim-mgt/pom.xml +++ b/features/claim-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/client-attestation-mgt/org.wso2.carbon.identity.client.attestation.mgt.server.feature/pom.xml b/features/client-attestation-mgt/org.wso2.carbon.identity.client.attestation.mgt.server.feature/pom.xml index 23419f6a6672..037b91df8c79 100644 --- a/features/client-attestation-mgt/org.wso2.carbon.identity.client.attestation.mgt.server.feature/pom.xml +++ b/features/client-attestation-mgt/org.wso2.carbon.identity.client.attestation.mgt.server.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.identity.framework client-attestation-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/client-attestation-mgt/pom.xml b/features/client-attestation-mgt/pom.xml index 4837d03f9c2b..1fc1ad139e3a 100644 --- a/features/client-attestation-mgt/pom.xml +++ b/features/client-attestation-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/features/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.server.feature/pom.xml b/features/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.server.feature/pom.xml index 2419d679a83e..892a9b8eb7c4 100644 --- a/features/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.server.feature/pom.xml +++ b/features/configuration-mgt/org.wso2.carbon.identity.configuration.mgt.server.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework configuration-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/configuration-mgt/pom.xml b/features/configuration-mgt/pom.xml index 22d1d0d62449..e95388d0cdde 100644 --- a/features/configuration-mgt/pom.xml +++ b/features/configuration-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/consent-mgt/org.wso2.carbon.identity.consent.mgt.server.feature/pom.xml b/features/consent-mgt/org.wso2.carbon.identity.consent.mgt.server.feature/pom.xml index ec05f7072465..502afb2b97e6 100644 --- a/features/consent-mgt/org.wso2.carbon.identity.consent.mgt.server.feature/pom.xml +++ b/features/consent-mgt/org.wso2.carbon.identity.consent.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-consent-mgt-aggregator - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/consent-mgt/pom.xml b/features/consent-mgt/pom.xml index 25f7fa4e2d5a..236966b1c09f 100644 --- a/features/consent-mgt/pom.xml +++ b/features/consent-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt.server.feature/pom.xml b/features/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt.server.feature/pom.xml index 9d80a402ee9e..dee01733a3a9 100644 --- a/features/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt.server.feature/pom.xml +++ b/features/consent-server-configs-mgt/org.wso2.carbon.identity.consent.server.configs.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework consent-server-configs-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/consent-server-configs-mgt/pom.xml b/features/consent-server-configs-mgt/pom.xml index bb7d208a5586..a4cf423187fe 100644 --- a/features/consent-server-configs-mgt/pom.xml +++ b/features/consent-server-configs-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/features/cors-mgt/org.wso2.carbon.identity.cors.mgt.server.feature/pom.xml b/features/cors-mgt/org.wso2.carbon.identity.cors.mgt.server.feature/pom.xml index 29e1ed358d52..8de2c20e909e 100644 --- a/features/cors-mgt/org.wso2.carbon.identity.cors.mgt.server.feature/pom.xml +++ b/features/cors-mgt/org.wso2.carbon.identity.cors.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework cors-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/cors-mgt/pom.xml b/features/cors-mgt/pom.xml index 85413d1dc327..ced99d7758f4 100644 --- a/features/cors-mgt/pom.xml +++ b/features/cors-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.feature/pom.xml b/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.feature/pom.xml index 72cb292418ed..39e91a63120a 100644 --- a/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.feature/pom.xml +++ b/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework directory-server-manager-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.server.feature/pom.xml b/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.server.feature/pom.xml index fc60ba26a546..734bb6dbd765 100644 --- a/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.server.feature/pom.xml +++ b/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework directory-server-manager-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.ui.feature/pom.xml b/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.ui.feature/pom.xml index 2e135b003d53..ddc9ce9310c5 100644 --- a/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.ui.feature/pom.xml +++ b/features/directory-server-manager/org.wso2.carbon.directory.service.mgr.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework directory-server-manager-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/directory-server-manager/pom.xml b/features/directory-server-manager/pom.xml index 9cfbc53fce2b..772d780debf7 100644 --- a/features/directory-server-manager/pom.xml +++ b/features/directory-server-manager/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/extension-mgt/org.wso2.carbon.identity.extension.mgt.feature/pom.xml b/features/extension-mgt/org.wso2.carbon.identity.extension.mgt.feature/pom.xml index 9079196f5cc3..a7b3d79d0a8d 100644 --- a/features/extension-mgt/org.wso2.carbon.identity.extension.mgt.feature/pom.xml +++ b/features/extension-mgt/org.wso2.carbon.identity.extension.mgt.feature/pom.xml @@ -19,7 +19,7 @@ extension-management-feature org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT org.wso2.carbon.identity.extension.mgt.feature diff --git a/features/extension-mgt/pom.xml b/features/extension-mgt/pom.xml index 457c1ba59277..f40b9d81d992 100644 --- a/features/extension-mgt/pom.xml +++ b/features/extension-mgt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.feature/pom.xml b/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.feature/pom.xml index e73c721eae44..998051465974 100644 --- a/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.feature/pom.xml +++ b/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework functions-library-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.server.feature/pom.xml b/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.server.feature/pom.xml index bc55cb6b2981..38f0534cbc0b 100644 --- a/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.server.feature/pom.xml +++ b/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework functions-library-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.ui.feature/pom.xml b/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.ui.feature/pom.xml index 4c7bee237ac1..b3c8dfe98688 100644 --- a/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.ui.feature/pom.xml +++ b/features/functions-library-mgt/org.wso2.carbon.identity.functions.library.mgt.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework functions-library-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/features/functions-library-mgt/pom.xml b/features/functions-library-mgt/pom.xml index 1655d0efcf69..395925ad131b 100644 --- a/features/functions-library-mgt/pom.xml +++ b/features/functions-library-mgt/pom.xml @@ -28,7 +28,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/identity-core/org.wso2.carbon.identity.core.feature/pom.xml b/features/identity-core/org.wso2.carbon.identity.core.feature/pom.xml index b8467f11879b..b30be91747cc 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.feature/pom.xml +++ b/features/identity-core/org.wso2.carbon.identity.core.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-core-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/pom.xml b/features/identity-core/org.wso2.carbon.identity.core.server.feature/pom.xml index 0c50e2da0e8b..6672912c5d34 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/pom.xml +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-core-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/identity.xml.j2 b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/identity.xml.j2 index fe3a436cf056..490feb4dcbca 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/identity.xml.j2 +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/identity.xml.j2 @@ -107,6 +107,27 @@ {{key_mgt.keystore_dir}} {{key_mgt.key_manager_type}} {{key_mgt.trust_manager_type}} + + + {% if keystore.mapping.oauth is defined %} + + {{keystore.mapping.oauth.keystore_file_name}} + {{keystore.mapping.oauth.use_in_all_tenants}} + + {% endif %} + {% if keystore.mapping.ws_trust is defined %} + + {{keystore.mapping.ws_trust.keystore_file_name}} + {{keystore.mapping.ws_trust.use_in_all_tenants}} + + {% endif %} + {% if keystore.mapping.ws_federation is defined %} + + {{keystore.mapping.ws_federation.keystore_file_name}} + {{keystore.mapping.ws_federation.use_in_all_tenants}} + + {% endif %} + @@ -2028,6 +2049,21 @@ + + {{actions.authentication.enable}} + + + {% for header in actions.types.authentication.action_request.excluded_headers %} +
{{header}}
+ {% endfor %} +
+ + {% for param in actions.types.authentication.action_request.excluded_parameters %} + {{param}} + {% endfor %} + +
+
diff --git a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/org.wso2.carbon.identity.core.server.feature.default.json b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/org.wso2.carbon.identity.core.server.feature.default.json index df0facd93e4f..babfa65ed470 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/org.wso2.carbon.identity.core.server.feature.default.json +++ b/features/identity-core/org.wso2.carbon.identity.core.server.feature/resources/org.wso2.carbon.identity.core.server.feature.default.json @@ -1154,8 +1154,7 @@ "console.applications.scopes.delete": ["internal_application_mgt_delete"], "console.applications.disabled_features": [ "applications.loginFlow.ai", - "applications.loginFlow.legacyEditor", - "applications.myaccount.saasMyaccountSettings" + "applications.loginFlow.legacyEditor" ], "console.applications.ui.certificate_alias_enabled": false, "console.application_roles.enabled": false, @@ -1285,7 +1284,11 @@ "console.insights.enabled": false, "console.login_and_registration.enabled": true, "console.login_and_registration.scopes.feature": ["console:loginAndRegistration"], - "console.login_and_registration.scopes.read": ["internal_governance_view"], + "console.login_and_registration.scopes.read": [ + "internal_governance_view", + "internal_group_mgt_view", + "internal_role_mgt_view" + ], "console.login_and_registration.scopes.update": [ "internal_governance_update", "internal_validation_rule_mgt_update", @@ -1606,7 +1609,7 @@ "client_assertion_type", "client_assertion" ], - + "actions.types.authentication.enable": true, "oauth.authorize_all_scopes": false } diff --git a/features/identity-core/org.wso2.carbon.identity.core.ui.feature/pom.xml b/features/identity-core/org.wso2.carbon.identity.core.ui.feature/pom.xml index 4743e1c18dc2..ba988528382d 100644 --- a/features/identity-core/org.wso2.carbon.identity.core.ui.feature/pom.xml +++ b/features/identity-core/org.wso2.carbon.identity.core.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-core-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/identity-core/pom.xml b/features/identity-core/pom.xml index ddd5f821e3c9..a4e6f641ae9c 100644 --- a/features/identity-core/pom.xml +++ b/features/identity-core/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/identity-event/org.wso2.carbon.identity.event.feature/pom.xml b/features/identity-event/org.wso2.carbon.identity.event.feature/pom.xml index 60750145fefe..23df77c10386 100644 --- a/features/identity-event/org.wso2.carbon.identity.event.feature/pom.xml +++ b/features/identity-event/org.wso2.carbon.identity.event.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-event-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/identity-event/org.wso2.carbon.identity.event.server.feature/pom.xml b/features/identity-event/org.wso2.carbon.identity.event.server.feature/pom.xml index 268dfce851df..bf13824fb094 100644 --- a/features/identity-event/org.wso2.carbon.identity.event.server.feature/pom.xml +++ b/features/identity-event/org.wso2.carbon.identity.event.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-event-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/identity-event/pom.xml b/features/identity-event/pom.xml index b7477b5c08f5..03206b657f92 100644 --- a/features/identity-event/pom.xml +++ b/features/identity-event/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/identity-mgt/org.wso2.carbon.identity.mgt.feature/pom.xml b/features/identity-mgt/org.wso2.carbon.identity.mgt.feature/pom.xml index e2085edb4047..538fdcaa231c 100644 --- a/features/identity-mgt/org.wso2.carbon.identity.mgt.feature/pom.xml +++ b/features/identity-mgt/org.wso2.carbon.identity.mgt.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/identity-mgt/org.wso2.carbon.identity.mgt.server.feature/pom.xml b/features/identity-mgt/org.wso2.carbon.identity.mgt.server.feature/pom.xml index 5d74f31098ab..446e1d07f077 100644 --- a/features/identity-mgt/org.wso2.carbon.identity.mgt.server.feature/pom.xml +++ b/features/identity-mgt/org.wso2.carbon.identity.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/identity-mgt/org.wso2.carbon.identity.mgt.ui.feature/pom.xml b/features/identity-mgt/org.wso2.carbon.identity.mgt.ui.feature/pom.xml index 893623d00857..bf808ae7c922 100644 --- a/features/identity-mgt/org.wso2.carbon.identity.mgt.ui.feature/pom.xml +++ b/features/identity-mgt/org.wso2.carbon.identity.mgt.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/identity-mgt/pom.xml b/features/identity-mgt/pom.xml index 0db49137f76c..c107daa292e5 100644 --- a/features/identity-mgt/pom.xml +++ b/features/identity-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/idp-mgt/org.wso2.carbon.idp.mgt.feature/pom.xml b/features/idp-mgt/org.wso2.carbon.idp.mgt.feature/pom.xml index 5cccfc3227b1..6c4d3f21da4a 100644 --- a/features/idp-mgt/org.wso2.carbon.idp.mgt.feature/pom.xml +++ b/features/idp-mgt/org.wso2.carbon.idp.mgt.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-provider-management-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/idp-mgt/org.wso2.carbon.idp.mgt.server.feature/pom.xml b/features/idp-mgt/org.wso2.carbon.idp.mgt.server.feature/pom.xml index bf0c6f0c0ef7..964dc3c5f31e 100644 --- a/features/idp-mgt/org.wso2.carbon.idp.mgt.server.feature/pom.xml +++ b/features/idp-mgt/org.wso2.carbon.idp.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-provider-management-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/idp-mgt/org.wso2.carbon.idp.mgt.ui.feature/pom.xml b/features/idp-mgt/org.wso2.carbon.idp.mgt.ui.feature/pom.xml index 469d21d93ed0..82cc7db17a72 100644 --- a/features/idp-mgt/org.wso2.carbon.idp.mgt.ui.feature/pom.xml +++ b/features/idp-mgt/org.wso2.carbon.idp.mgt.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-provider-management-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/idp-mgt/pom.xml b/features/idp-mgt/pom.xml index 982fd78c5876..42444bbf0aef 100644 --- a/features/idp-mgt/pom.xml +++ b/features/idp-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/input-validation-mgt/org.wso2.carbon.identity.input.validation.mgt.server.feature/pom.xml b/features/input-validation-mgt/org.wso2.carbon.identity.input.validation.mgt.server.feature/pom.xml index 4a2fb68a6190..2fec90993382 100644 --- a/features/input-validation-mgt/org.wso2.carbon.identity.input.validation.mgt.server.feature/pom.xml +++ b/features/input-validation-mgt/org.wso2.carbon.identity.input.validation.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework input-validation-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/input-validation-mgt/pom.xml b/features/input-validation-mgt/pom.xml index 37e4ae7ecf9b..fef6b1f49826 100644 --- a/features/input-validation-mgt/pom.xml +++ b/features/input-validation-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/features/multi-attribute-login/org.wso2.carbon.identity.multi.attribute.login.mgt.server.feature/pom.xml b/features/multi-attribute-login/org.wso2.carbon.identity.multi.attribute.login.mgt.server.feature/pom.xml index ab98cab7202f..9dc06f737594 100644 --- a/features/multi-attribute-login/org.wso2.carbon.identity.multi.attribute.login.mgt.server.feature/pom.xml +++ b/features/multi-attribute-login/org.wso2.carbon.identity.multi.attribute.login.mgt.server.feature/pom.xml @@ -20,7 +20,7 @@ multi-attribute-login-feature org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/features/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt.server.feature/pom.xml b/features/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt.server.feature/pom.xml index ded258b82bc4..3fb9bd9b0d16 100644 --- a/features/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt.server.feature/pom.xml +++ b/features/multi-attribute-login/org.wso2.carbon.identity.unique.claim.mgt.server.feature/pom.xml @@ -20,7 +20,7 @@ multi-attribute-login-feature org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/features/multi-attribute-login/pom.xml b/features/multi-attribute-login/pom.xml index f16095cd2ab8..dc138381271b 100644 --- a/features/multi-attribute-login/pom.xml +++ b/features/multi-attribute-login/pom.xml @@ -20,7 +20,7 @@ identity-framework org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/notification-mgt/org.wso2.carbon.identity.notification.mgt.feature/pom.xml b/features/notification-mgt/org.wso2.carbon.identity.notification.mgt.feature/pom.xml index 1cde76ff8da5..534cd32ad6fc 100644 --- a/features/notification-mgt/org.wso2.carbon.identity.notification.mgt.feature/pom.xml +++ b/features/notification-mgt/org.wso2.carbon.identity.notification.mgt.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-notification-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/notification-mgt/org.wso2.carbon.identity.notification.mgt.server.feature/pom.xml b/features/notification-mgt/org.wso2.carbon.identity.notification.mgt.server.feature/pom.xml index 1fb89f978e54..fae1b2d0d080 100644 --- a/features/notification-mgt/org.wso2.carbon.identity.notification.mgt.server.feature/pom.xml +++ b/features/notification-mgt/org.wso2.carbon.identity.notification.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-notification-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/notification-mgt/pom.xml b/features/notification-mgt/pom.xml index 20f7e4495ab8..02c1a5097d66 100644 --- a/features/notification-mgt/pom.xml +++ b/features/notification-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/provisioning/org.wso2.carbon.identity.provisioning.server.feature/pom.xml b/features/provisioning/org.wso2.carbon.identity.provisioning.server.feature/pom.xml index 884bb8b2ea30..66ac15237f4d 100644 --- a/features/provisioning/org.wso2.carbon.identity.provisioning.server.feature/pom.xml +++ b/features/provisioning/org.wso2.carbon.identity.provisioning.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework provisioning-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/provisioning/pom.xml b/features/provisioning/pom.xml index 9c06642c7d37..f75de225d5e3 100644 --- a/features/provisioning/pom.xml +++ b/features/provisioning/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/role-mgt/org.wso2.carbon.identity.role.mgt.core.server.feature/pom.xml b/features/role-mgt/org.wso2.carbon.identity.role.mgt.core.server.feature/pom.xml index d304f1182bf8..1a04fbfc3568 100644 --- a/features/role-mgt/org.wso2.carbon.identity.role.mgt.core.server.feature/pom.xml +++ b/features/role-mgt/org.wso2.carbon.identity.role.mgt.core.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework role-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/features/role-mgt/org.wso2.carbon.identity.role.v2.mgt.core.server.feature/pom.xml b/features/role-mgt/org.wso2.carbon.identity.role.v2.mgt.core.server.feature/pom.xml index e8232aa961ce..7b9f2dad9155 100644 --- a/features/role-mgt/org.wso2.carbon.identity.role.v2.mgt.core.server.feature/pom.xml +++ b/features/role-mgt/org.wso2.carbon.identity.role.v2.mgt.core.server.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework role-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/features/role-mgt/pom.xml b/features/role-mgt/pom.xml index 7f6ccfd80940..97181bdc1d89 100644 --- a/features/role-mgt/pom.xml +++ b/features/role-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/features/secret-mgt/org.wso2.carbon.identity.secret.mgt.core.server.feature/pom.xml b/features/secret-mgt/org.wso2.carbon.identity.secret.mgt.core.server.feature/pom.xml index 551802fea5fd..9ed70fd7b219 100644 --- a/features/secret-mgt/org.wso2.carbon.identity.secret.mgt.core.server.feature/pom.xml +++ b/features/secret-mgt/org.wso2.carbon.identity.secret.mgt.core.server.feature/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.identity.framework secret-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT 4.0.0 diff --git a/features/secret-mgt/pom.xml b/features/secret-mgt/pom.xml index dda8c8aa8fa6..7e46bd1c209c 100644 --- a/features/secret-mgt/pom.xml +++ b/features/secret-mgt/pom.xml @@ -19,7 +19,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/security-mgt/org.wso2.carbon.security.mgt.feature/pom.xml b/features/security-mgt/org.wso2.carbon.security.mgt.feature/pom.xml index bec0f2ea6df8..fe6900f3de4a 100644 --- a/features/security-mgt/org.wso2.carbon.security.mgt.feature/pom.xml +++ b/features/security-mgt/org.wso2.carbon.security.mgt.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework security-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/security-mgt/org.wso2.carbon.security.mgt.server.feature/pom.xml b/features/security-mgt/org.wso2.carbon.security.mgt.server.feature/pom.xml index 8d3a98445b41..12a136682b2b 100644 --- a/features/security-mgt/org.wso2.carbon.security.mgt.server.feature/pom.xml +++ b/features/security-mgt/org.wso2.carbon.security.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework security-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/security-mgt/org.wso2.carbon.security.mgt.ui.feature/pom.xml b/features/security-mgt/org.wso2.carbon.security.mgt.ui.feature/pom.xml index 803c30fb0ef5..b69db43e5e36 100644 --- a/features/security-mgt/org.wso2.carbon.security.mgt.ui.feature/pom.xml +++ b/features/security-mgt/org.wso2.carbon.security.mgt.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework security-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/security-mgt/pom.xml b/features/security-mgt/pom.xml index 4d54875da672..ed68e28b4195 100644 --- a/features/security-mgt/pom.xml +++ b/features/security-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/template-mgt/org.wso2.carbon.identity.template.mgt.feature/pom.xml b/features/template-mgt/org.wso2.carbon.identity.template.mgt.feature/pom.xml index b67281ac466c..ee267cae41cb 100644 --- a/features/template-mgt/org.wso2.carbon.identity.template.mgt.feature/pom.xml +++ b/features/template-mgt/org.wso2.carbon.identity.template.mgt.feature/pom.xml @@ -21,7 +21,7 @@ template-management-feature org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/template-mgt/org.wso2.carbon.identity.template.mgt.server.feature/pom.xml b/features/template-mgt/org.wso2.carbon.identity.template.mgt.server.feature/pom.xml index 57cf9a187808..f57a88b36c3c 100644 --- a/features/template-mgt/org.wso2.carbon.identity.template.mgt.server.feature/pom.xml +++ b/features/template-mgt/org.wso2.carbon.identity.template.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ template-management-feature org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/template-mgt/org.wso2.carbon.identity.template.mgt.ui.feature/pom.xml b/features/template-mgt/org.wso2.carbon.identity.template.mgt.ui.feature/pom.xml index 127685b831f5..c91767f0d925 100644 --- a/features/template-mgt/org.wso2.carbon.identity.template.mgt.ui.feature/pom.xml +++ b/features/template-mgt/org.wso2.carbon.identity.template.mgt.ui.feature/pom.xml @@ -21,7 +21,7 @@ template-management-feature org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/template-mgt/pom.xml b/features/template-mgt/pom.xml index b4dab36b37ca..7deceee8af3c 100644 --- a/features/template-mgt/pom.xml +++ b/features/template-mgt/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/trusted-app-mgt/org.wso2.carbon.identity.trusted.app.mgt.server.feature/pom.xml b/features/trusted-app-mgt/org.wso2.carbon.identity.trusted.app.mgt.server.feature/pom.xml index c1068136930f..9a4caebea2cb 100644 --- a/features/trusted-app-mgt/org.wso2.carbon.identity.trusted.app.mgt.server.feature/pom.xml +++ b/features/trusted-app-mgt/org.wso2.carbon.identity.trusted.app.mgt.server.feature/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.identity.framework trusted-app-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/trusted-app-mgt/pom.xml b/features/trusted-app-mgt/pom.xml index 5194474fb25b..1d355f8b441e 100644 --- a/features/trusted-app-mgt/pom.xml +++ b/features/trusted-app-mgt/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/features/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt.feature/pom.xml b/features/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt.feature/pom.xml index 1cffefda155d..905debdfc60c 100644 --- a/features/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt.feature/pom.xml +++ b/features/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt.feature/pom.xml @@ -21,7 +21,7 @@ user-functionality-mgt-feature org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/features/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt.server.feature/pom.xml b/features/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt.server.feature/pom.xml index d4cd98689b56..466be8eab1a8 100644 --- a/features/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt.server.feature/pom.xml +++ b/features/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt.server.feature/pom.xml @@ -21,7 +21,7 @@ user-functionality-mgt-feature org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT 4.0.0 diff --git a/features/user-functionality-mgt/pom.xml b/features/user-functionality-mgt/pom.xml index bb9533322d70..9904a4d2597c 100644 --- a/features/user-functionality-mgt/pom.xml +++ b/features/user-functionality-mgt/pom.xml @@ -21,7 +21,7 @@ identity-framework org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/features/user-mgt/org.wso2.carbon.identity.user.profile.feature/pom.xml b/features/user-mgt/org.wso2.carbon.identity.user.profile.feature/pom.xml index e6138bedaa5d..ff5577aaa5d3 100644 --- a/features/user-mgt/org.wso2.carbon.identity.user.profile.feature/pom.xml +++ b/features/user-mgt/org.wso2.carbon.identity.user.profile.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-mgt/org.wso2.carbon.identity.user.profile.server.feature/pom.xml b/features/user-mgt/org.wso2.carbon.identity.user.profile.server.feature/pom.xml index c8ad53c47912..d7c4a9c2a9ee 100644 --- a/features/user-mgt/org.wso2.carbon.identity.user.profile.server.feature/pom.xml +++ b/features/user-mgt/org.wso2.carbon.identity.user.profile.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-mgt/org.wso2.carbon.identity.user.profile.ui.feature/pom.xml b/features/user-mgt/org.wso2.carbon.identity.user.profile.ui.feature/pom.xml index 9bbd4e8fe558..fe32516b1157 100644 --- a/features/user-mgt/org.wso2.carbon.identity.user.profile.ui.feature/pom.xml +++ b/features/user-mgt/org.wso2.carbon.identity.user.profile.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-mgt/org.wso2.carbon.identity.user.registration.feature/pom.xml b/features/user-mgt/org.wso2.carbon.identity.user.registration.feature/pom.xml index 00feb6f6802c..33de4ff34a12 100644 --- a/features/user-mgt/org.wso2.carbon.identity.user.registration.feature/pom.xml +++ b/features/user-mgt/org.wso2.carbon.identity.user.registration.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-mgt/org.wso2.carbon.identity.user.registration.server.feature/pom.xml b/features/user-mgt/org.wso2.carbon.identity.user.registration.server.feature/pom.xml index 9ec22fcd563f..cfd4c0748ac0 100644 --- a/features/user-mgt/org.wso2.carbon.identity.user.registration.server.feature/pom.xml +++ b/features/user-mgt/org.wso2.carbon.identity.user.registration.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-mgt/org.wso2.carbon.identity.user.registration.ui.feature/pom.xml b/features/user-mgt/org.wso2.carbon.identity.user.registration.ui.feature/pom.xml index e239afab654b..4505ee815d80 100644 --- a/features/user-mgt/org.wso2.carbon.identity.user.registration.ui.feature/pom.xml +++ b/features/user-mgt/org.wso2.carbon.identity.user.registration.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework user-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-mgt/org.wso2.carbon.role.mgt.ui.feature/pom.xml b/features/user-mgt/org.wso2.carbon.role.mgt.ui.feature/pom.xml index 57a440333b93..3ed76201de73 100644 --- a/features/user-mgt/org.wso2.carbon.role.mgt.ui.feature/pom.xml +++ b/features/user-mgt/org.wso2.carbon.role.mgt.ui.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework user-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-mgt/org.wso2.carbon.user.mgt.feature/pom.xml b/features/user-mgt/org.wso2.carbon.user.mgt.feature/pom.xml index 61739b875249..e8f5084afc0b 100644 --- a/features/user-mgt/org.wso2.carbon.user.mgt.feature/pom.xml +++ b/features/user-mgt/org.wso2.carbon.user.mgt.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework user-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-mgt/org.wso2.carbon.user.mgt.server.feature/pom.xml b/features/user-mgt/org.wso2.carbon.user.mgt.server.feature/pom.xml index 9ac110bac40a..98302916ba02 100644 --- a/features/user-mgt/org.wso2.carbon.user.mgt.server.feature/pom.xml +++ b/features/user-mgt/org.wso2.carbon.user.mgt.server.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework user-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-mgt/org.wso2.carbon.user.mgt.ui.feature/pom.xml b/features/user-mgt/org.wso2.carbon.user.mgt.ui.feature/pom.xml index 5aecf27897dd..24645e49b9d6 100644 --- a/features/user-mgt/org.wso2.carbon.user.mgt.ui.feature/pom.xml +++ b/features/user-mgt/org.wso2.carbon.user.mgt.ui.feature/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.identity.framework user-mgt-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-mgt/pom.xml b/features/user-mgt/pom.xml index 043098e86512..9db3e1407b8c 100644 --- a/features/user-mgt/pom.xml +++ b/features/user-mgt/pom.xml @@ -17,7 +17,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/user-store/org.wso2.carbon.identity.user.store.configuration.server.feature/pom.xml b/features/user-store/org.wso2.carbon.identity.user.store.configuration.server.feature/pom.xml index 87ed101140c6..f36cb02d9518 100644 --- a/features/user-store/org.wso2.carbon.identity.user.store.configuration.server.feature/pom.xml +++ b/features/user-store/org.wso2.carbon.identity.user.store.configuration.server.feature/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.identity.framework user-store-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/user-store/pom.xml b/features/user-store/pom.xml index e5d2cb6b83e5..ed66b74f5db1 100644 --- a/features/user-store/pom.xml +++ b/features/user-store/pom.xml @@ -23,7 +23,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/features/xacml/org.wso2.carbon.identity.xacml.feature/pom.xml b/features/xacml/org.wso2.carbon.identity.xacml.feature/pom.xml index 8fa44f872c2b..bee71858f1b7 100644 --- a/features/xacml/org.wso2.carbon.identity.xacml.feature/pom.xml +++ b/features/xacml/org.wso2.carbon.identity.xacml.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework xacml-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/xacml/org.wso2.carbon.identity.xacml.server.feature/pom.xml b/features/xacml/org.wso2.carbon.identity.xacml.server.feature/pom.xml index 2acb5f8a864c..c3a68a182ced 100644 --- a/features/xacml/org.wso2.carbon.identity.xacml.server.feature/pom.xml +++ b/features/xacml/org.wso2.carbon.identity.xacml.server.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework xacml-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/xacml/org.wso2.carbon.identity.xacml.ui.feature/pom.xml b/features/xacml/org.wso2.carbon.identity.xacml.ui.feature/pom.xml index b520da06734d..4d6f9efcce3a 100644 --- a/features/xacml/org.wso2.carbon.identity.xacml.ui.feature/pom.xml +++ b/features/xacml/org.wso2.carbon.identity.xacml.ui.feature/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework xacml-feature - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/features/xacml/pom.xml b/features/xacml/pom.xml index 89ccafe87271..28bfbb49e841 100644 --- a/features/xacml/pom.xml +++ b/features/xacml/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/pom.xml b/pom.xml index 4b68a0bdbd0e..723bdfe89e72 100644 --- a/pom.xml +++ b/pom.xml @@ -1,18 +1,20 @@ @@ -20,7 +22,7 @@ org.wso2.carbon.identity.framework identity-framework pom - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT WSO2 Carbon - Platform Aggregator Pom http://wso2.org @@ -1736,6 +1738,11 @@ jettison ${codehaus.jettison.version} + + org.apache.httpcomponents + httpclient + ${apache.httpcomponents.httpclient.version} + org.springframework spring-web @@ -1854,11 +1861,12 @@ 1.4.0 5.1.1.RELEASE 1.1.1 + 4.3.5 UTF-8 - 4.10.10 + 4.10.19 4.7.0 [4.5.0, 5.0.0) [1.0.1, 2.0.0) @@ -2128,7 +2136,7 @@ 7.10.1 - 0.8.4 + 0.8.12 1.44 3.2.5 5.3.1 @@ -2267,6 +2275,25 @@
+ + org.jacoco + jacoco-maven-plugin + ${jacoco.version} + + + + prepare-agent + + + + report + test + + report + + + + diff --git a/service-stubs/identity/org.wso2.carbon.claim.mgt.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.claim.mgt.stub/pom.xml index 0600853cb209..519dec752aaa 100644 --- a/service-stubs/identity/org.wso2.carbon.claim.mgt.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.claim.mgt.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.directory.server.manager.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.directory.server.manager.stub/pom.xml index ecd3fd589dc6..9833e9fdac20 100644 --- a/service-stubs/identity/org.wso2.carbon.directory.server.manager.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.directory.server.manager.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.identity.application.authentication.framework.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.application.authentication.framework.stub/pom.xml index ea1413ff65ab..c245a49ff5e8 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.application.authentication.framework.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.application.authentication.framework.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml 4.0.0 diff --git a/service-stubs/identity/org.wso2.carbon.identity.application.default.authentication.sequence.mgt.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.application.default.authentication.sequence.mgt.stub/pom.xml index 15571f46a67f..e70a19299690 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.application.default.authentication.sequence.mgt.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.application.default.authentication.sequence.mgt.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.identity.application.mgt.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.application.mgt.stub/pom.xml index 699802f1c43f..85f4c11190f8 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.application.mgt.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.application.mgt.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.identity.claim.metadata.mgt.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.claim.metadata.mgt.stub/pom.xml index 8330c705042b..d6068803fde6 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.claim.metadata.mgt.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.claim.metadata.mgt.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.identity.entitlement.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.entitlement.stub/pom.xml index ab3e301a7d5f..6fbc2d49dc25 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.entitlement.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.entitlement.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.identity.functions.library.mgt.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.functions.library.mgt.stub/pom.xml index fc4ff736814f..858db46859d7 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.functions.library.mgt.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.functions.library.mgt.stub/pom.xml @@ -21,7 +21,7 @@ carbon-service-stubs org.wso2.carbon.identity.framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT 4.0.0 diff --git a/service-stubs/identity/org.wso2.carbon.identity.governance.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.governance.stub/pom.xml index 03fbd543dd77..658091097ea3 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.governance.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.governance.stub/pom.xml @@ -18,7 +18,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.identity.mgt.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.mgt.stub/pom.xml index 8b2cae574b11..3d5a5d6aa8ef 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.mgt.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.mgt.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.identity.user.profile.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.user.profile.stub/pom.xml index c81bc4cd8897..aadf1b202178 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.user.profile.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.user.profile.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.identity.user.registration.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.user.registration.stub/pom.xml index c713bc32a389..4e9bf94c6213 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.user.registration.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.user.registration.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.identity.user.store.configuration.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.user.store.configuration.stub/pom.xml index 7534ec897ff9..e3ec9332d8ab 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.user.store.configuration.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.user.store.configuration.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.identity.user.store.count.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.identity.user.store.count.stub/pom.xml index f36f0e73a9a0..920ac908ccd1 100644 --- a/service-stubs/identity/org.wso2.carbon.identity.user.store.count.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.identity.user.store.count.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.idp.mgt.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.idp.mgt.stub/pom.xml index 32a93ae1545a..493abe6cf515 100644 --- a/service-stubs/identity/org.wso2.carbon.idp.mgt.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.idp.mgt.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.security.mgt.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.security.mgt.stub/pom.xml index d0c5cc2f2667..012865c96f32 100644 --- a/service-stubs/identity/org.wso2.carbon.security.mgt.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.security.mgt.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/org.wso2.carbon.user.mgt.stub/pom.xml b/service-stubs/identity/org.wso2.carbon.user.mgt.stub/pom.xml index 7580502e62ee..20644b8a7c41 100644 --- a/service-stubs/identity/org.wso2.carbon.user.mgt.stub/pom.xml +++ b/service-stubs/identity/org.wso2.carbon.user.mgt.stub/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework carbon-service-stubs - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../pom.xml diff --git a/service-stubs/identity/pom.xml b/service-stubs/identity/pom.xml index 635ec23b23ee..e4de6af92f2f 100644 --- a/service-stubs/identity/pom.xml +++ b/service-stubs/identity/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml diff --git a/test-utils/org.wso2.carbon.identity.testutil/pom.xml b/test-utils/org.wso2.carbon.identity.testutil/pom.xml index 2d58ed7a037b..a0b5ccf3f8a6 100644 --- a/test-utils/org.wso2.carbon.identity.testutil/pom.xml +++ b/test-utils/org.wso2.carbon.identity.testutil/pom.xml @@ -18,7 +18,7 @@ org.wso2.carbon.identity.framework identity-framework - 7.4.16-SNAPSHOT + 7.5.13-SNAPSHOT ../../pom.xml