feat: establish AIOA identity and organization baseline

This commit is contained in:
selfrelease
2026-07-18 08:05:45 +08:00
commit bbb09ed56f
42 changed files with 2473 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
# Scripts
后续放置开发环境检查、契约生成、数据库迁移和本地启动脚本。脚本必须可重复运行,不得包含密钥。
`verify-local-auth.sh` 使用 Keycloak Realm 中明确标记为仅限本地开发的账号,验证健康检查、Token 获取和 `/api/v1/me`。不得把该脚本及其测试凭据用于共享或生产环境。
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail
keycloak_url="${KEYCLOAK_URL:-http://localhost:8081}"
backend_url="${BACKEND_URL:-http://localhost:8080}"
curl --fail --silent --show-error "${backend_url}/actuator/health" | jq .
for username in employee manager admin; do
case "${username}" in
employee) password='Employee123!' ;;
manager) password='Manager123!' ;;
admin) password='Admin123!' ;;
esac
token="$({
curl --fail --silent --show-error \
-X POST "${keycloak_url}/realms/aioa/protocol/openid-connect/token" \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode client_id=aioa-mobile \
--data-urlencode grant_type=password \
--data-urlencode username="${username}" \
--data-urlencode password="${password}"
} | jq -r .access_token)"
printf '%s\n' "${username}"
curl --fail --silent --show-error \
"${backend_url}/api/v1/me" \
-H "Authorization: Bearer ${token}" | jq .
done