huace-aigc-auth-client 1.1.26__py3-none-any.whl → 1.1.27__py3-none-any.whl

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.
@@ -172,4 +172,4 @@ __all__ = [
172
172
  # 用户上下文
173
173
  "get_current_user",
174
174
  ]
175
- __version__ = "1.1.26"
175
+ __version__ = "1.1.27"
@@ -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:
@@ -698,14 +706,6 @@ class AuthMiddleware:
698
706
  params["form_params"] = form_params
699
707
  except Exception:
700
708
  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
709
709
  # 其他类型(如 application/octet-stream 等二进制流)直接跳过,不读取
710
710
 
711
711
  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.27
4
4
  Summary: 华策AIGC Auth Client - 提供 Token 验证、用户信息获取、权限检查、旧系统接入等功能
5
5
  Author-email: Huace <support@huace.com>
6
6
  License: MIT
@@ -1,12 +1,12 @@
1
- huace_aigc_auth_client/__init__.py,sha256=UvYxKO3l-WAdwb8Is69IZROn4xJtTzmxOZprp4d_dQg,4630
1
+ huace_aigc_auth_client/__init__.py,sha256=XkPDfVkTRYhsWlUaPfeaXqNTIKyDQlEa-TefQedlu0g,4630
2
2
  huace_aigc_auth_client/api_stats_collector.py,sha256=UCUu2CHWsJyiAM58-XLQtfxWK0fjZ8TTdw90gv_Gx04,10347
3
3
  huace_aigc_auth_client/legacy_adapter.py,sha256=TVCBAKejE2z2HQFsEwDW8LMiaIkXNfz3Mxv6_E-UJFY,24102
4
- huace_aigc_auth_client/sdk.py,sha256=79n-CRyUY6Q7TVS_a5I-U39BB_WA_P_dLiFdAJjZmiE,37255
4
+ huace_aigc_auth_client/sdk.py,sha256=cRwOQ-AzrthNUprj2Q5WvQ1GIeDxY-AgdMciw0Ous90,37182
5
5
  huace_aigc_auth_client/user_context.py,sha256=KzevYLsLv1hv8rlvRw83FT-HugeoBJSJ1Pi56iLWyTE,5592
6
6
  huace_aigc_auth_client/webhook.py,sha256=XQZYEbMoqIdqZWCGSTcedeDKJpDbUVSq5g08g-6Qucg,4124
7
7
  huace_aigc_auth_client/webhook_flask.py,sha256=Iosu4dBtRhQZM_ytn-bn82MpVsyOiV28FBnt7Tfh31U,7225
8
- huace_aigc_auth_client-1.1.26.dist-info/licenses/LICENSE,sha256=z7dgC7KljhBLNvKjN15391nMj3aLt0gbud8-Yf1F8EQ,1063
9
- huace_aigc_auth_client-1.1.26.dist-info/METADATA,sha256=n8tmSxO9LtOYxmNvmrkZShMNTjwi8zM9mPsxk3s9efI,23629
10
- huace_aigc_auth_client-1.1.26.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
11
- huace_aigc_auth_client-1.1.26.dist-info/top_level.txt,sha256=kbv0nQ6PQ0JVneWPH7O2AbtlJnP7AjvFJ6JjM6ZEBxo,23
12
- huace_aigc_auth_client-1.1.26.dist-info/RECORD,,
8
+ huace_aigc_auth_client-1.1.27.dist-info/licenses/LICENSE,sha256=z7dgC7KljhBLNvKjN15391nMj3aLt0gbud8-Yf1F8EQ,1063
9
+ huace_aigc_auth_client-1.1.27.dist-info/METADATA,sha256=wi4IFWXXPgBBUKOO98ept8GxuCkYpT-VUVih_mbYLbk,23629
10
+ huace_aigc_auth_client-1.1.27.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
11
+ huace_aigc_auth_client-1.1.27.dist-info/top_level.txt,sha256=kbv0nQ6PQ0JVneWPH7O2AbtlJnP7AjvFJ6JjM6ZEBxo,23
12
+ huace_aigc_auth_client-1.1.27.dist-info/RECORD,,