huace-aigc-auth-client 1.1.26__tar.gz → 1.1.28__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (19) hide show
  1. {huace_aigc_auth_client-1.1.26/huace_aigc_auth_client.egg-info → huace_aigc_auth_client-1.1.28}/PKG-INFO +1 -1
  2. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/__init__.py +1 -1
  3. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/sdk.py +9 -20
  4. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28/huace_aigc_auth_client.egg-info}/PKG-INFO +1 -1
  5. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/pyproject.toml +1 -1
  6. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/LICENSE +0 -0
  7. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/MANIFEST.in +0 -0
  8. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/QUICK_START.txt +0 -0
  9. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/README.md +0 -0
  10. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/api_stats_collector.py +0 -0
  11. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/legacy_adapter.py +0 -0
  12. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/user_context.py +0 -0
  13. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/webhook.py +0 -0
  14. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client/webhook_flask.py +0 -0
  15. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client.egg-info/SOURCES.txt +0 -0
  16. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client.egg-info/dependency_links.txt +0 -0
  17. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client.egg-info/requires.txt +0 -0
  18. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/huace_aigc_auth_client.egg-info/top_level.txt +0 -0
  19. {huace_aigc_auth_client-1.1.26 → huace_aigc_auth_client-1.1.28}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: huace-aigc-auth-client
3
- Version: 1.1.26
3
+ Version: 1.1.28
4
4
  Summary: 华策AIGC Auth Client - 提供 Token 验证、用户信息获取、权限检查、旧系统接入等功能
5
5
  Author-email: Huace <support@huace.com>
6
6
  License: MIT
@@ -172,4 +172,4 @@ __all__ = [
172
172
  # 用户上下文
173
173
  "get_current_user",
174
174
  ]
175
- __version__ = "1.1.26"
175
+ __version__ = "1.1.28"
@@ -672,6 +672,14 @@ class AuthMiddleware:
672
672
 
673
673
  # 获取请求体(使用白名单方式,只处理已知安全的内容类型)
674
674
  content_type = request.headers.get("content-type", "").lower()
675
+ # 读取请求体(需要特殊处理以避免消耗流)
676
+ body = b""
677
+ if request.method in ["POST", "PUT", "PATCH"]:
678
+ try:
679
+ body = await request.body()
680
+ except:
681
+ pass
682
+ params["request_body"] = body.decode('utf-8', errors='ignore')
675
683
 
676
684
  if "application/json" in content_type:
677
685
  try:
@@ -686,26 +694,7 @@ class AuthMiddleware:
686
694
  pass
687
695
  elif "multipart/form-data" in content_type:
688
696
  # 文件上传请求,不读取 body,避免损坏文件流
689
- # 只收集表单字段(非文件字段)
690
- try:
691
- form = await request.form()
692
- form_params = {}
693
- for k, v in form.items():
694
- if hasattr(v, "filename"):
695
- # 跳过文件字段
696
- continue
697
- form_params[k] = v
698
- params["form_params"] = form_params
699
- except Exception:
700
- pass
701
- elif content_type.startswith('text/'):
702
- # 只读取文本类型的请求体,且限制大小避免内存问题
703
- try:
704
- body = await request.body()
705
- if body and len(body) < 10240: # 限制10KB避免内存问题
706
- params["request_body"] = body.decode('utf-8')
707
- except Exception:
708
- pass
697
+ params["form_params"] = {"skipped_multipart": True}
709
698
  # 其他类型(如 application/octet-stream 等二进制流)直接跳过,不读取
710
699
 
711
700
  return params
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: huace-aigc-auth-client
3
- Version: 1.1.26
3
+ Version: 1.1.28
4
4
  Summary: 华策AIGC Auth Client - 提供 Token 验证、用户信息获取、权限检查、旧系统接入等功能
5
5
  Author-email: Huace <support@huace.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "huace-aigc-auth-client"
7
- version = "1.1.26"
7
+ version = "1.1.28"
8
8
  description = "华策AIGC Auth Client - 提供 Token 验证、用户信息获取、权限检查、旧系统接入等功能"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.7"