Skip to content

Commit 06e3a53

Browse files
committed
[fit] 添加fit-security-simple插件
1 parent 02fef53 commit 06e3a53

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>org.fitframework.plugin</groupId>
8+
<artifactId>fit-plugin-parent</artifactId>
9+
<version>3.6.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>fit-security-simple</artifactId>
13+
14+
<properties>
15+
<jackson.version>2.18.2</jackson.version>
16+
17+
<lombok.version>1.18.36</lombok.version>
18+
</properties>
19+
20+
<dependencyManagement>
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.fitframework</groupId>
24+
<artifactId>fit-dependency</artifactId>
25+
<version>${fit.version}</version>
26+
<type>pom</type>
27+
<scope>import</scope>
28+
</dependency>
29+
</dependencies>
30+
</dependencyManagement>
31+
32+
<dependencies>
33+
<!-- FIT core -->
34+
<dependency>
35+
<groupId>org.fitframework</groupId>
36+
<artifactId>fit-api</artifactId>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.fitframework</groupId>
40+
<artifactId>fit-util</artifactId>
41+
</dependency>
42+
43+
<!-- Micro genericables -->
44+
<dependency>
45+
<groupId>org.fitframework.service</groupId>
46+
<artifactId>fit-security</artifactId>
47+
</dependency>
48+
</dependencies>
49+
50+
<build>
51+
<plugins>
52+
<plugin>
53+
<groupId>org.fitframework</groupId>
54+
<artifactId>fit-build-maven-plugin</artifactId>
55+
<version>${fit.version}</version>
56+
<configuration>
57+
<category>system</category>
58+
<level>1</level>
59+
</configuration>
60+
<executions>
61+
<execution>
62+
<id>build-plugin</id>
63+
<goals>
64+
<goal>build-plugin</goal>
65+
</goals>
66+
</execution>
67+
<execution>
68+
<id>package-plugin</id>
69+
<goals>
70+
<goal>package-plugin</goal>
71+
</goals>
72+
</execution>
73+
</executions>
74+
</plugin>
75+
</plugins>
76+
</build>
77+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) 2025 Huawei Technologies Co., Ltd. All rights reserved.
3+
* This file is a part of the ModelEngine Project.
4+
* Licensed under the MIT License. See License.txt in the project root for license information.
5+
*--------------------------------------------------------------------------------------------*/
6+
7+
package modelengine.fit.security.simple;
8+
9+
import modelengine.fit.security.Decryptor;
10+
import modelengine.fit.security.Encryptor;
11+
import modelengine.fitframework.annotation.Component;
12+
import modelengine.fitframework.util.StringUtils;
13+
14+
/**
15+
* 表示 {@link Decryptor} 的简单实现。
16+
*
17+
* @author 季聿阶
18+
* @since 2023-07-31
19+
*/
20+
@Component
21+
public class SimpleCipher implements Encryptor, Decryptor {
22+
@Override
23+
public String encrypt(String decrypted) {
24+
return CIPHER_PREFIX + decrypted + CIPHER_SUFFIX;
25+
}
26+
27+
@Override
28+
public String decrypt(String encrypted) {
29+
if (StringUtils.startsWithIgnoreCase(encrypted, CIPHER_PREFIX) && StringUtils.endsWithIgnoreCase(encrypted, CIPHER_SUFFIX)) {
30+
return encrypted.substring(CIPHER_PREFIX.length(), encrypted.length() - CIPHER_SUFFIX.length());
31+
}
32+
return encrypted;
33+
}
34+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fit:
2+
beans:
3+
packages:
4+
- 'modelengine.fit.security.simple'

framework/fit/java/fit-builtin/plugins/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<module>fit-logger</module>
2727
<module>fit-message-serializer-cbor</module>
2828
<module>fit-message-serializer-json-jackson</module>
29+
<module>fit-security-simple</module>
2930
<module>fit-server-http</module>
3031
<module>fit-service-coordination-locator</module>
3132
<module>fit-service-coordination-simple</module>

0 commit comments

Comments
 (0)