-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6281 from ashanthamara/pre-update-password
Add Pre Update Password action management related files
- Loading branch information
Showing
21 changed files
with
1,956 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
174 changes: 174 additions & 0 deletions
174
components/user-mgt/org.wso2.carbon.identity.user.pre.update.password.action/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (c) 2025, 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. | ||
--> | ||
|
||
<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>user-mgt</artifactId> | ||
<version>7.7.138-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<artifactId>org.wso2.carbon.identity.user.pre.update.password.action</artifactId> | ||
<packaging>bundle</packaging> | ||
<name>WSO2 Carbon - Pre Update Password Action Service</name> | ||
<description>The Pre Update Password Action Service backend component</description> | ||
<url>http://wso2.org</url> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.identity.action.management</artifactId> | ||
</dependency> | ||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.wso2.carbon.identity.framework</groupId> | ||
<artifactId>org.wso2.carbon.identity.testutil</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<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.pre.update.password.action.core.constant, | ||
org.wso2.carbon.identity.user.pre.update.password.action.core.management, | ||
org.wso2.carbon.identity.user.pre.update.password.action.internal | ||
</Private-Package> | ||
<Export-Package> | ||
org.wso2.carbon.identity.user.pre.update.password.action.service.*; | ||
version="${carbon.identity.package.export.version}" | ||
</Export-Package> | ||
<Import-Package> | ||
org.apache.commons.lang; version="${commons-lang.wso2.osgi.version.range}", | ||
org.apache.commons.logging; version="${import.package.version.commons.logging}", | ||
org.osgi.framework; version="${osgi.framework.imp.pkg.version.range}", | ||
org.osgi.service.component; version="${osgi.service.component.imp.pkg.version.range}", | ||
org.wso2.carbon.identity.action.management.exception; version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.action.management.model; version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.action.management.service; version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.certificate.management.service; version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.certificate.management.exception; version="${carbon.identity.package.import.version.range}", | ||
org.wso2.carbon.identity.certificate.management.model; version="${carbon.identity.package.import.version.range}" | ||
</Import-Package> | ||
</instructions> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${maven.surefire.plugin.version}</version> | ||
<configuration> | ||
<suiteXmlFiles> | ||
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile> | ||
</suiteXmlFiles> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jacoco</groupId> | ||
<artifactId>jacoco-maven-plugin</artifactId> | ||
<version>${jacoco.version}</version> | ||
<executions> | ||
<execution> | ||
<id>default-prepare-agent</id> | ||
<goals> | ||
<goal>prepare-agent</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>default-prepare-agent-integration</id> | ||
<goals> | ||
<goal>prepare-agent-integration</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>default-report</id> | ||
<goals> | ||
<goal>report</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>default-report-integration</id> | ||
<goals> | ||
<goal>report-integration</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>default-check</id> | ||
<goals> | ||
<goal>check</goal> | ||
</goals> | ||
<configuration> | ||
<rules> | ||
<rule implementation="org.jacoco.maven.RuleConfiguration"> | ||
<element>BUNDLE</element> | ||
<limits> | ||
<limit implementation="org.jacoco.report.check.Limit"> | ||
<counter>LINE</counter> | ||
<value>COVEREDRATIO</value> | ||
<minimum>0.80</minimum> | ||
</limit> | ||
<limit implementation="org.jacoco.report.check.Limit"> | ||
<counter>COMPLEXITY</counter> | ||
<value>COVEREDRATIO</value> | ||
<minimum>0.60</minimum> | ||
</limit> | ||
</limits> | ||
</rule> | ||
</rules> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>com.github.spotbugs</groupId> | ||
<artifactId>spotbugs-maven-plugin</artifactId> | ||
<configuration> | ||
<excludeFilterFile>../../../spotbugs-exclude.xml</excludeFilterFile> | ||
<effort>Max</effort> | ||
<threshold>High</threshold> | ||
<xmlOutput>true</xmlOutput> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
32 changes: 32 additions & 0 deletions
32
...ntity/user/pre/update/password/action/core/constant/PreUpdatePasswordActionConstants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) 2025, 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.user.pre.update.password.action.core.constant; | ||
|
||
/** | ||
* This class holds the constants used in Pre Update Password extension. | ||
*/ | ||
public class PreUpdatePasswordActionConstants { | ||
|
||
public static final String PASSWORD_SHARING_FORMAT = "passwordSharingFormat"; | ||
public static final String CERTIFICATE = "certificate"; | ||
|
||
private PreUpdatePasswordActionConstants() { | ||
|
||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
...ity/user/pre/update/password/action/core/management/PreUpdatePasswordActionConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* Copyright (c) 2025, 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.user.pre.update.password.action.core.management; | ||
|
||
import org.wso2.carbon.identity.action.management.model.Action; | ||
import org.wso2.carbon.identity.action.management.model.ActionDTO; | ||
import org.wso2.carbon.identity.action.management.service.ActionConverter; | ||
import org.wso2.carbon.identity.certificate.management.model.Certificate; | ||
import org.wso2.carbon.identity.user.pre.update.password.action.service.model.PasswordSharing; | ||
import org.wso2.carbon.identity.user.pre.update.password.action.service.model.PreUpdatePasswordAction; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.wso2.carbon.identity.user.pre.update.password.action.core.constant.PreUpdatePasswordActionConstants.CERTIFICATE; | ||
import static org.wso2.carbon.identity.user.pre.update.password.action.core.constant.PreUpdatePasswordActionConstants.PASSWORD_SHARING_FORMAT; | ||
|
||
/** | ||
* This class implements the methods required to build Action objects in Pre Update Password extension. | ||
*/ | ||
public class PreUpdatePasswordActionConverter implements ActionConverter { | ||
|
||
@Override | ||
public Action.ActionTypes getSupportedActionType() { | ||
|
||
return Action.ActionTypes.PRE_UPDATE_PASSWORD; | ||
} | ||
|
||
/** | ||
* This method builds the ActionDTO object from the PreUpdatePasswordAction object in action creation and update. | ||
* | ||
* @param action PreUpdatePasswordAction object. | ||
* @return ActionDTO object. | ||
* | ||
*/ | ||
@Override | ||
public ActionDTO buildActionDTO(Action action) { | ||
|
||
PreUpdatePasswordAction preUpdatePasswordAction = (PreUpdatePasswordAction) action; | ||
PasswordSharing passwordSharing = preUpdatePasswordAction.getPasswordSharing(); | ||
|
||
Map<String, Object> properties = new HashMap<>(); | ||
if (passwordSharing != null && passwordSharing.getFormat() != null) { | ||
properties.put(PASSWORD_SHARING_FORMAT, passwordSharing.getFormat()); | ||
} | ||
if (passwordSharing != null && passwordSharing.getCertificate() != null) { | ||
properties.put(CERTIFICATE, passwordSharing.getCertificate()); | ||
} | ||
|
||
return new ActionDTO.Builder(preUpdatePasswordAction) | ||
.properties(properties) | ||
.build(); | ||
} | ||
|
||
@Override | ||
public Action buildAction(ActionDTO actionDTO) { | ||
|
||
Map<String, Object> properties = actionDTO.getProperties(); | ||
PasswordSharing.Builder passwordSharingBuilder = new PasswordSharing.Builder(); | ||
passwordSharingBuilder.format((PasswordSharing.Format) actionDTO.getProperties().get(PASSWORD_SHARING_FORMAT)); | ||
if (properties.get(CERTIFICATE) != null) { | ||
passwordSharingBuilder.certificate((Certificate) actionDTO.getProperties().get(CERTIFICATE)); | ||
} | ||
|
||
return new PreUpdatePasswordAction.ResponseBuilder() | ||
.id(actionDTO.getId()) | ||
.type(actionDTO.getType()) | ||
.name(actionDTO.getName()) | ||
.description(actionDTO.getDescription()) | ||
.status(actionDTO.getStatus()) | ||
.endpoint(actionDTO.getEndpoint()) | ||
.passwordSharing(passwordSharingBuilder.build()) | ||
.build(); | ||
} | ||
} |
Oops, something went wrong.