Java SDK
Java SDK 面向 Spring Security 资源服务器与服务端管理集成。 core 集成使用 WEB 或 M2M 机密 ApplicationClient。 可选 Java BFF 模块为 Spring 应用提供 Hosted/自定义服务端会话。
本地构建与安装
SDK 目前未发布到 Maven Central。使用 JDK 21 或更新版本构建清单记录的提交:
git clone https://github.com/axis-iam/vertex-sdk-java.git
cd vertex-sdk-java
git checkout 9b7d1c84cbd051a52b08f5c51a3838c2c92cceb8
bash gradlew :vertex-sdk-core:publishToMavenLocal
在 settings.gradle.kts 中,将本地 Maven 仓库限定到 Axis Vertex 坐标;第三方依赖使用 Maven Central:
dependencyResolutionManagement {
repositories {
exclusiveContent {
forRepository { mavenLocal() }
filter { includeGroup("com.chaosguide.iam") }
}
mavenCentral()
}
}
在 build.gradle.kts 中使用该源码当前声明的版本:
dependencies {
implementation("com.chaosguide.iam:vertex-sdk-core:0.1.0")
}
快速入门
import com.chaosguide.iam.vertex.EnableIamSecurity;
import com.chaosguide.iam.vertex.authz.PermissionKey;
import org.springframework.context.annotation.Configuration;
@Configuration
@EnableIamSecurity
class VertexSecurityConfiguration {
static final PermissionKey ORDERS_READ = new PermissionKey("orders", "read");
}
Spring 后端使用同一个 Application 下独立的 WEB/M2M 机密 client:
iam:
sdk:
endpoint: https://auth.example.com
client-id: ${IAM_CLIENT_ID}
client-secret: ${IAM_CLIENT_SECRET}
resource-audience: ${IAM_RESOURCE_AUDIENCE}
fail-mode: CLOSE
endpoint 是 Vertex issuer;client ID 与 secret 属于当前后端,不是 SPA/NATIVE client。SDK 推导 issuer/JWKS、
校验 bearer token,并通过 Vertex 解析当前权限,不信任 token 中的 permissions claim。Secret 只能保存在服务端。
资源服务器与管理边界
入站用户 bearer token 使用 @EnableIamSecurity 与 @RequirePerm。服务端管理自动化才使用
PortalOpenApiClient,并配置另一个只具备 roles:read、registration_grants:write 等精确 scope 的 M2M
client。不能向浏览器暴露 PortalOpenApiClient、其 secret 或管理响应。
将 iam.sdk.resource-audience 设为 Application 的资源 audience;此配置必填,缺失时拒绝启动。
解码器校验 ES256/RS256 签名、issuer、audience、过期时间与 not-before。audience 是 API 标识,不是浏览器或服务端 client ID。
Permission Manifest 同步必须由服务端显式调用;自动配置不会在应用启动时发布或修改权限。
API 参考
Gradle Javadoc 是 Java 可调用接口的权威参考。文档构建会在链接生成结果前校验公开 class 与模块公开边界。