Support signed UserInfo responses in the OIDC client
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 74/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- authentication
Hướng nghiên cứu
Bắt đầu tại userinfo() trong authlib/integrations/base_client/sync_openid.py (dòng 32-38) và bản tương ứng trong async_openid.py, sau đó đọc parse_id_token trong cùng các file để xem cách giải mã JWT với fetch_jwk_set() và xác thực iss/aud đã được thực hiện như thế nào. Phân nhánh theo Content-Type của phản hồi: application/jwt nghĩa là giải mã dưới dạng JWT đã ký và xác thực iss và aud, ngược lại giữ nguyên đường dẫn JSON hiện tại. Thêm các test hồi quy bao phủ cả phản hồi UserInfo dạng JSON lẫn phản hồi JWT đã ký; hoàn thành nghĩa là phản hồi JWT đã ký trả về các claim mà không phát sinh JSONDecodeError, cả trong client sync lẫn async.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
OIDC Core §5.3.2 (https://openid.net/specs/openid-connect-core-1_0.html#UserInfoResponse) allows clients to receive the UserInfo response as a JWT. This happens when the client registers userinfo_signed_response_alg:
The UserInfo Claims MUST be returned as the members of a JSON object unless a signed or encrypted response was requested during Client Registration. [...] If the UserInfo Response is signed and/or encrypted, then the Claims are returned in a JWT and the content-type MUST be application/jwt. [...] If signed, the UserInfo Response MUST contain the Claims iss (issuer) and aud (audience) as members.
Currently userinfo() always parses the response as JSON, so it fails with a JSONDecodeError when the response is a JWT:
This happens with ProConnect (https://partenaires.proconnect.gouv.fr/docs/fournisseur-service/implementation_technique), the French government identity federation. Its UserInfo endpoint returns a signed JWT, and the user claims (given_name, usual_name, email…) are not in the id_token. So clients have no choice but to read them from the UserInfo endpoint.
Authlib should support this. Maybe userinfo() could check the response Content-Type. When it is application/jwt, it could decode the JWT with fetch_jwk_set(), the same way parse_id_token does. Then it would validate iss and aud. The same change would be needed in the async client:
Encrypted responses could be left for later.
- Ngôn ngữ chính
- Python
- Star
- 5.4k
- Fork
- 570
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của authlib/authlib
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
CVE-2026-96760: fixed or not?Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 57/100
-
[RFC 6749 Conformance] AuthorizationCodeGrant does not enforce code expiration at framework levelĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
-
`authlib.common.security.generate_token`, at least when used for PKCE code verifiers, should follow RFC 7636 recommendationsCó thể đã có người làm @pranjalm37 đã nhận 24 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
-
support `httpx.URL` objects for urlsCó thể đã có người làm @gyanu2507 đã nhận 43 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Tất cả issue của authlib/authlib
Issue tương tự
-
pulp-cli 0.41 break username password auth in older configs (cert and key present but empty)Đang mởbug Triage-Needed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
FuRongJun-1999/dsh-memory#170 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[开源推荐] 打拼音就出篆书的输入法,附古文字创作小工具Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
521xueweihan/HelloGitHub#3940 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100