feat: add native/Java auth SDK, docs, CI, and examples

Made-with: Cursor
This commit is contained in:
hpd840321
2026-04-06 17:42:09 +08:00
commit 3894315759
35 changed files with 4825 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.craftlabs</groupId>
<artifactId>craftlabs-auth-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>craftlabs-auth-tests</artifactId>
<name>CraftLabs Auth — integration tests</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>cn.craftlabs</groupId>
<artifactId>craftlabs-auth-bitanswer</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<native.library.path>${project.basedir}/../../native/build</native.library.path>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Djava.library.path=${native.library.path}</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,30 @@
package cn.craftlabs.auth;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import cn.craftlabs.auth.bitanswer.BitAnswerProvider;
import org.junit.jupiter.api.Test;
/**
* {@link BitAnswerProvider} 集成测试(依赖 native 桩)。
*
* <p>版权所有 © 广州创飞人工智能技术有限公司
*
* @author huangping@craftlabs.cn
*/
class BitAnswerProviderTest {
@Test
void initializeCheckAndLicenseInfo_roundTrip() {
try (AuthProvider p = new BitAnswerProvider()) {
AuthResult init = p.initialize("{}");
assertTrue(init.isSuccess(), init.getMessage());
AuthResult ok = p.checkLicense();
assertTrue(ok.isSuccess(), ok.getMessage());
LicenseInfo info = p.getLicenseInfo();
assertNotNull(info);
assertTrue(info.isLicensed());
}
}
}