identity_fn.AuthBlockingEvent is still missing auth_type and resource
还没有人认领这个 Issue。
评估
调研方向
从 src/firebase_functions/identity_fn.py 中的 AuthBlockingEvent dataclass 开始,它旁边是 #231 添加的字段(event_type、email_type、sms_type)。按照链接的 Node 端 parseAuthEventContext 逻辑推导两个新属性:auth_type 根据 user_record 是否存在得出,resource 根据 tenant_id 和项目 ID 得出。完成的标准是复现片段不再抛出 AttributeError,且 identity_fn 的现有测试套件通过,并覆盖租户和非租户两种情况。
由索引模型根据 Issue 内容生成。
描述
Summary
#231 added event_type, email_type, and sms_type to identity_fn.AuthBlockingEvent (thanks!). Two properties from the blocking functions doc are still missing, so code written from the doc fails on Python:
| Doc property | Node firebase-functions |
Python firebase-functions |
|---|---|---|
authType |
authType: "USER" | "UNAUTHENTICATED" |
not present |
resource |
resource: { service, name } |
not present |
Repro
from firebase_functions import identity_fn
@identity_fn.before_user_signed_in()
def handle(event: identity_fn.AuthBlockingEvent):
event.auth_type # AttributeError
event.resource # AttributeError
Checked against the AuthBlockingEvent dataclass on main (identity_fn.py) and in 0.6.0.
Where the values come from
The Node SDK derives both from the blocking token rather than reading dedicated claims, so Python can do the same. From parseAuthEventContext:
authTypeis"USER"when the token has auser_record, otherwise"UNAUTHENTICATED".resource.serviceisidentitytoolkit.googleapis.com, andresource.nameisprojects/<project-id>/tenants/<tenant_id>when the token has atenant_id, otherwiseprojects/<project-id>.
Context
First reported in firebase/functions-samples#1129 and in #224, which #231 partly addressed. I'm closing the samples issue in favor of this one, since the fix belongs in the SDK. Until then, the tenant is available as event.data.tenant_id.
- 主要语言
- Python
- 星标
- 167
- 派生
- 36
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
firebase/firebase-functions-python 的其他 Issue
-
HttpsError.__init__ does not pass message to super().__init__()可能已有人在做 @Aayush99910 于 2 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
firebase/firebase-functions-python#314 · 1 条评论 ·
-
Add support for VPC direct connect可能已有人在做 @IzaakGough 于 107 天前认领。 未关闭feature-request
难度 4/5 3-5 天 新手友好度 48/100
firebase/firebase-functions-python#275 · 1 条评论 · 1 个 reaction ·
-
feature-request
难度 4/5 3-5 天 新手友好度 35/100
firebase/firebase-functions-python#271 · 3 条评论 ·
-
[Bug] stability_digest_payload_from_ce_payload fails with AttributeError: 'dict' object has no attribute 'split'可能重新可做 关联的 PR 已关闭且未合并。 未关闭bug unable to reproduce
难度 3/5 1-2 天 新手友好度 55/100
firebase/firebase-functions-python#260 · 6 条评论 ·
-
feature-request
难度 5/5 一周以上 新手友好度 25/100
firebase/firebase-functions-python#249 · 2 条评论 ·
查看 firebase/firebase-functions-python 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
MystenLabs/MemWal#1163 · 2 条评论 ·
维护者通常 1 天内回复
-
infertopics leaves new nodes without a topic when untopiced neighbours outnumber topiced ones可能已有人在做 @moneebullah25 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
FinanceFlash/unvibecode#218 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
NVIDIA/earth2studio#1241 ·
维护者通常 3 天内回复