Merge branch 'test' into prod
This commit is contained in:
commit
ebf115e1c3
8 files changed
+36
-34
No files matched your search
@@ -18,7 +18,7 @@ CASDOOR_SCOPE=openid profile email
|
|||||||
# Casdoor Providers → wecom(Name=wecom,与 prod 共用同一 Provider 即可)
|
# Casdoor Providers → wecom(Name=wecom,与 prod 共用同一 Provider 即可)
|
||||||
CASDOOR_WECOM_PROVIDER_HINT=wecom
|
CASDOOR_WECOM_PROVIDER_HINT=wecom
|
||||||
|
|
||||||
AUTH_JWT_ISSUER=http://192.168.100.230:8870
|
AUTH_JWT_ISSUER=http://ai.well-trust.com:8870
|
||||||
AUTH_JWT_AUDIENCE=<hxops-dev-client-id>
|
AUTH_JWT_AUDIENCE=<hxops-dev-client-id>
|
||||||
AUTH_JWT_JWKS_URL=http://192.168.100.230:8870/.well-known/jwks
|
AUTH_JWT_JWKS_URL=http://192.168.100.230:8870/.well-known/jwks
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ CASDOOR_SCOPE=openid profile email
|
|||||||
# Casdoor Providers → wecom:Name 字段(截图即为 wecom);Organization=organization_HX,Sub type=Internal,Scope=snsapi_userinfo
|
# Casdoor Providers → wecom:Name 字段(截图即为 wecom);Organization=organization_HX,Sub type=Internal,Scope=snsapi_userinfo
|
||||||
CASDOOR_WECOM_PROVIDER_HINT=wecom
|
CASDOOR_WECOM_PROVIDER_HINT=wecom
|
||||||
|
|
||||||
AUTH_JWT_ISSUER=http://192.168.100.230:8870
|
AUTH_JWT_ISSUER=http://ai.well-trust.com:8870
|
||||||
AUTH_JWT_AUDIENCE=758be5fcba2df784fdb4
|
AUTH_JWT_AUDIENCE=758be5fcba2df784fdb4
|
||||||
AUTH_JWT_JWKS_URL=http://192.168.100.230:8870/.well-known/jwks
|
AUTH_JWT_JWKS_URL=http://192.168.100.230:8870/.well-known/jwks
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ CASDOOR_SCOPE=openid profile email
|
|||||||
# Casdoor Providers → wecom(Name=wecom)
|
# Casdoor Providers → wecom(Name=wecom)
|
||||||
CASDOOR_WECOM_PROVIDER_HINT=wecom
|
CASDOOR_WECOM_PROVIDER_HINT=wecom
|
||||||
|
|
||||||
AUTH_JWT_ISSUER=http://192.168.100.230:8870
|
AUTH_JWT_ISSUER=http://ai.well-trust.com:8870
|
||||||
AUTH_JWT_AUDIENCE=<hxops-test-client-id>
|
AUTH_JWT_AUDIENCE=<hxops-test-client-id>
|
||||||
AUTH_JWT_JWKS_URL=http://192.168.100.230:8870/.well-known/jwks
|
AUTH_JWT_JWKS_URL=http://192.168.100.230:8870/.well-known/jwks
|
||||||
|
|
||||||
|
|||||||
Vendored
-29
@@ -51,35 +51,6 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Validate Docker Inputs') {
|
|
||||||
steps {
|
|
||||||
sh '''
|
|
||||||
set -e
|
|
||||||
test -f docker-compose.yml
|
|
||||||
test -f backend/Dockerfile
|
|
||||||
test -f "docs/(表+字段).md"
|
|
||||||
|
|
||||||
if grep -Eq '^docs/?$' .dockerignore 2>/dev/null && ! grep -Fxq '!docs/(表+字段).md' .dockerignore; then
|
|
||||||
echo "[Validate Docker Inputs] .dockerignore excludes docs, but docs/(表+字段).md is not re-included."
|
|
||||||
echo "[Validate Docker Inputs] Please keep docs/(表+字段).md in the Docker build context for Text2SQL."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! grep -Fq 'context: .' docker-compose.yml || ! grep -Fq 'dockerfile: backend/Dockerfile' docker-compose.yml; then
|
|
||||||
echo "[Validate Docker Inputs] docker-compose.yml must build hxops-backend from repository root with backend/Dockerfile."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! grep -Fq 'COPY docs/(表+字段).md /app/docs/(表+字段).md' backend/Dockerfile; then
|
|
||||||
echo "[Validate Docker Inputs] backend/Dockerfile must copy docs/(表+字段).md into the image."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "[Validate Docker Inputs] Docker build context and Text2SQL schema inputs are ready."
|
|
||||||
'''
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Detect Changes') {
|
stage('Detect Changes') {
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
|
|||||||
+3
-1
@@ -6,9 +6,11 @@ INTEGRATION_API_KEY=I76mSQZQEPYU6TubMhjh-xLsCgWC0gSIg5MncJFHFCvqvVlg-gZ_BvwO_UEL
|
|||||||
AUTH_JWT_REQUIRED=true
|
AUTH_JWT_REQUIRED=true
|
||||||
|
|
||||||
AUTH_LOGIN_MODE=casdoor
|
AUTH_LOGIN_MODE=casdoor
|
||||||
|
# 如果需要用户密码登录,修改该值为password
|
||||||
|
# AUTH_LOGIN_MODE=password
|
||||||
|
|
||||||
# Casdoor JWT 验签三件套
|
# Casdoor JWT 验签三件套
|
||||||
AUTH_JWT_ISSUER=http://192.168.100.230:8870
|
AUTH_JWT_ISSUER=http://ai.well-trust.com:8870
|
||||||
AUTH_JWT_AUDIENCE=758be5fcba2df784fdb4
|
AUTH_JWT_AUDIENCE=758be5fcba2df784fdb4
|
||||||
AUTH_JWT_JWKS_URL=http://192.168.100.230:8870/.well-known/jwks
|
AUTH_JWT_JWKS_URL=http://192.168.100.230:8870/.well-known/jwks
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,24 @@ def _decode_jwt(token: str) -> dict:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _extract_unverified_claims(token: str) -> dict:
|
||||||
|
"""Best-effort decode without signature verification for troubleshooting logs."""
|
||||||
|
try:
|
||||||
|
return jwt.decode(
|
||||||
|
token,
|
||||||
|
options={
|
||||||
|
'verify_signature': False,
|
||||||
|
'verify_exp': False,
|
||||||
|
'verify_iat': False,
|
||||||
|
'verify_nbf': False,
|
||||||
|
'verify_aud': False,
|
||||||
|
'verify_iss': False,
|
||||||
|
},
|
||||||
|
) or {}
|
||||||
|
except Exception:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
|
||||||
def _resolve_user_from_claims(claims: dict) -> Optional[User]:
|
def _resolve_user_from_claims(claims: dict) -> Optional[User]:
|
||||||
# Resolution order keeps compatibility with different token claim conventions.
|
# Resolution order keeps compatibility with different token claim conventions.
|
||||||
user_id = claims.get('user_id') or claims.get('id')
|
user_id = claims.get('user_id') or claims.get('id')
|
||||||
@@ -195,6 +213,16 @@ def get_current_user() -> Optional[User]:
|
|||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
# Any decode/lookup failure should behave as unauthenticated.
|
# Any decode/lookup failure should behave as unauthenticated.
|
||||||
|
unverified = _extract_unverified_claims(token)
|
||||||
|
expected_issuer = (current_app.config.get('AUTH_JWT_ISSUER') or '').strip()
|
||||||
|
expected_audience = (current_app.config.get('AUTH_JWT_AUDIENCE') or '').strip()
|
||||||
|
current_app.logger.error(
|
||||||
|
'[auth_jwt] decode context token_iss=%s token_aud=%s expected_iss=%s expected_aud=%s',
|
||||||
|
unverified.get('iss'),
|
||||||
|
unverified.get('aud'),
|
||||||
|
expected_issuer,
|
||||||
|
expected_audience,
|
||||||
|
)
|
||||||
current_app.logger.exception('[auth_jwt] decode failed token=%s path=%s', _token_brief(token), request.path)
|
current_app.logger.exception('[auth_jwt] decode failed token=%s path=%s', _token_brief(token), request.path)
|
||||||
user = None
|
user = None
|
||||||
claims = None
|
claims = None
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ set -e
|
|||||||
# Hxops 部署脚本 (优化版)
|
# Hxops 部署脚本 (优化版)
|
||||||
# 用途: 自动拉取代码、构建前端、重启容器
|
# 用途: 自动拉取代码、构建前端、重启容器
|
||||||
# 使用: ./deploy.sh
|
# 使用: ./deploy.sh
|
||||||
|
# 备注:该文件用于手动在服务器上执行该脚本,Jenkins自动部署已不用该文件
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
echo "🚀 开始部署 Hxops..."
|
echo "🚀 开始部署 Hxops..."
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export const config = {
|
|||||||
// Login mode switch:
|
// Login mode switch:
|
||||||
// - 'casdoor': submit username/password to backend Casdoor password-login API.
|
// - 'casdoor': submit username/password to backend Casdoor password-login API.
|
||||||
// - 'password': submit to legacy local /api/user/login.
|
// - 'password': submit to legacy local /api/user/login.
|
||||||
loginMode: 'password',
|
loginMode: 'casdoor',
|
||||||
casdoor: {
|
casdoor: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
authorizeApi: '/api/user/casdoor/authorize-url',
|
authorizeApi: '/api/user/casdoor/authorize-url',
|
||||||
|
|||||||
Reference in new issue
Block a user