Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce registration framework and registration flow management service #6568

Merged
merged 27 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
bb3c099
Core implementation for user registration framework
pamodaaw Feb 21, 2025
fd225c8
Introduce builder classes for the DTOs
pamodaaw Feb 21, 2025
f5815df
Add database functions to store and get registration dto
pamodaaw Feb 21, 2025
a6bc7c5
Remove blocks and add recursive components
pamodaaw Feb 22, 2025
9a93f5d
Update the graph builder logic
pamodaaw Feb 24, 2025
88481a8
Support reg flow get operation
pamodaaw Feb 24, 2025
fdce065
Introduce DataDTO to the StepDTO
pamodaaw Feb 24, 2025
b2385a8
Add error handling
pamodaaw Feb 24, 2025
a367103
Add database schema
pamodaaw Feb 24, 2025
4ae2710
Add user-self-registration to the main pom
pamodaaw Feb 24, 2025
350ef69
Refactor code
pamodaaw Feb 24, 2025
9e05f22
Address review comments
pamodaaw Feb 25, 2025
fe4ff88
Introduce a node type for prompt instead of executor
pamodaaw Feb 25, 2025
335e1ef
Update dao layer
pamodaaw Feb 26, 2025
9563381
Add audit logger
pamodaaw Feb 26, 2025
bbef643
Address review comments
pamodaaw Feb 27, 2025
2a7df05
update pom versions
ThaminduR Feb 27, 2025
fe454d9
Rename module and add unit tests
ThaminduR Feb 27, 2025
b7e288a
Add unit tests and h2 sql script
ThaminduR Feb 27, 2025
17215cc
remove unneccessary tables
ThaminduR Feb 27, 2025
e33839f
Address review comments
ThaminduR Feb 27, 2025
11c8362
update pom versions
ThaminduR Feb 28, 2025
fbcc863
revert loggerutils change
ThaminduR Feb 28, 2025
6d60f59
Update pom.xml
ThaminduR Feb 28, 2025
a21ec48
Update pom.xml
ThaminduR Feb 28, 2025
0309821
update pom
ThaminduR Feb 28, 2025
c3a94d7
update pom
ThaminduR Feb 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,16 @@ public static class UserManagement {
public static final String DELETED_PERMISSIONS_FIELD = "DeletedPermissions";
public static final String DELETED_IDP_GROUPS_FIELD = "DeletedIdpGroups";
}

/**
* Registration flow management related log constants.
*/
public static class RegistrationFlowManagement {

public static final String UPDATE_REGISTRATION_FLOW = "update-registration-flow";

private RegistrationFlowManagement() {

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public enum Initiator {
* Defines the Targets of the logs.
*/
public enum Target {
User, Role, Group, Application, Action
User, Role, Group, Application, Action, Flow
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
~
~ 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.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>identity-framework</artifactId>
<version>7.8.27-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>

<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.identity.user.registration.mgt</artifactId>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Identity User Self Registration Flow Manager</name>
<description>WSO2 user self registration flow management</description>
<url>http://www.wso2.com</url>

<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.logging</groupId>
<artifactId>pax-logging-api</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.utils</groupId>
<artifactId>org.wso2.carbon.database.utils</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.core</artifactId>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.central.log.mgt</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.testutil</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Private-Package>
org.wso2.carbon.identity.user.registration.mgt.internal
</Private-Package>
<Import-Package>
javax.xml.parsers; version="${javax.xml.parsers.import.pkg.version}",
org.xml.sax,
org.w3c.dom,
org.osgi.framework; version="${osgi.framework.imp.pkg.version.range}",
org.apache.xerces.util.*; resolution:=optional,
org.apache.commons.logging; version="${import.package.version.commons.logging}",
org.osgi.service.component; version="${osgi.service.component.imp.pkg.version.range}",
org.wso2.carbon.utils.*; version="${carbon.kernel.package.import.version.range}",
org.wso2.carbon.database.utils.jdbc;version="${org.wso2.carbon.database.utils.version.range}",
org.wso2.carbon.database.utils.jdbc.exceptions;version="${org.wso2.carbon.database.utils.version.range}",
org.wso2.carbon.identity.core.util;
version="${carbon.identity.package.import.version.range}",
org.wso2.carbon.identity.central.log.mgt.utils;
version="${carbon.identity.package.import.version.range}",
javax.servlet.http; version="${imp.pkg.version.javax.servlet}"
</Import-Package>
<Export-Package>
!org.wso2.carbon.identity.user.registration.mgt.internal,
org.wso2.carbon.identity.user.registration.mgt.*;
version="${carbon.identity.package.export.version}"
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/*
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
*
* 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.user.registration.mgt;

/**
* Constants for the self registration flow.
*/
public class Constants {

public static final String COMPLETE = "COMPLETE";
public static final String DEFAULT_FLOW_NAME = "defaultFlow";

private Constants() {

}

public enum ErrorMessages {

// Server errors.
ERROR_CODE_ADD_DEFAULT_FLOW("65001", "Error while updating the flow.",
"Unexpected server error while updating the default flow in tenant, %s"),

ERROR_CODE_GET_DEFAULT_FLOW("65002", "Error while retrieving the flow.",
"Unexpected server error while retrieving the default flow from database in " +
"tenant, %s"),

ERROR_CODE_SERIALIZE_PAGE_CONTENT("65003", "Error while serializing the page content.",
"Unexpected server error while serializing the page content for step %s" +
" in tenant, %s"),
ERROR_CODE_INVALID_NODE("65004", "Node id not found.", "Could not resolve a valid node with id, %s to create " +
"a link."),
ERROR_CODE_DESERIALIZE_PAGE_CONTENT("65005", "Error while deserializing the page content.",
"Unexpected server error while deserializing the page content for step %s" +
" in tenant, %s"),
ERROR_CODE_GET_REG_GRAPH_FAILED("65006", "Error while retrieving the registration graph.",
"Unexpected server error while retrieving the registration graph for tenant, " +
"%s"),

// Client errors.
ERROR_CODE_UNSUPPORTED_STEP_TYPE("60001", "Unsupported step type.",
"The step type, %s is not supported."),
ERROR_CODE_STEP_DATA_NOT_FOUND("60002", "Step data not found.",
"The step data for step, %s is not found."),
ERROR_CODE_COMPONENT_DATA_NOT_FOUND("60003", "Component data not found.",
"The step, %s of type view must have components defined."),
ERROR_CODE_INVALID_ACTION_FOR_BUTTON("60004", "Invalid action configuration.",
"The component, %s of type button must have an action defined."),
ERROR_CODE_NEXT_ACTION_NOT_FOUND("60005", "Invalid action configuration.",
"Next step is not defined for the action in component, %s."),
ERROR_CODE_EXECUTOR_INFO_NOT_FOUND("60006", "Invalid action configuration.",
"Executor data is not defined for the action type EXECUTOR in component, " +
"%s."),
ERROR_CODE_MULTIPLE_STEP_EXECUTORS("60007", "Multiple executors defined for the step.",
"Multiple executors are defined for the step, %s."),
ERROR_CODE_UNSUPPORTED_ACTION_TYPE("60008", "Unsupported action type.",
"The action type, %s defined for component %s is not supported."),
ERROR_CODE_INVALID_NEXT_STEP("600009", "Invalid next step configuration.", "Cannot resolve a step for the " +
"next id, %s."),
ERROR_CODE_ACTION_DATA_NOT_FOUND("60010", "Action data not found.",
"The step, %s of type redirection must have action defined"),
ERROR_CODE_INVALID_ACTION_TYPE("60011", "Invalid action type.",
"The action type, %s is not supported for step, %s of type redirection."),
;

private static final String ERROR_PREFIX = "RFM";
private final String code;
private final String message;
private final String description;

ErrorMessages(String code, String message, String description) {

this.code = ERROR_PREFIX + "-" + 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;
}
}

/**
* Constants for the node types.
*/
public static class NodeTypes {

public static final String DECISION = "DECISION";
public static final String TASK_EXECUTION = "TASK_EXECUTION";
public static final String PROMPT_ONLY = "PROMPT_ONLY";

private NodeTypes() {

}
}

/**
* Constants for the step types.
*/
public static class StepTypes {

public static final String VIEW = "VIEW";
public static final String REDIRECTION = "REDIRECTION";

private StepTypes() {

}
}

public static class ComponentTypes {

public static final String FORM = "FORM";
public static final String BUTTON = "BUTTON";

private ComponentTypes() {

}
}

/**
* Constants for the action types.
*/
public static class ActionTypes {

public static final String EXECUTOR = "EXECUTOR";
public static final String NEXT = "NEXT";

private ActionTypes() {

}
}

/**
* Constants for defined executor types.
*/
public static class ExecutorTypes {

public static final String USER_ONBOARDING = "UserOnboardingExecutor";

private ExecutorTypes() {

}
}
}
Loading