Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Support signed UserInfo responses in the OIDC client

Đang mở Phù hợp với người mới
#941 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

@choksi2212 đang làm issue này rồi.

Từ ngày 10/10/2026.

  • #950 của @choksi2212 — đang mở

Đá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ả

role:client spec:oidc-core

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:

https://github.com/authlib/authlib/blob/c529a61af40e3efe05286140e00fbdced07d7987/authlib/integrations/base_client/sync_openid.py#L32-L38

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:

https://github.com/authlib/authlib/blob/c529a61af40e3efe05286140e00fbdced07d7987/authlib/integrations/base_client/async_openid.py#L34-L40

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của authlib/authlib

Tất cả issue của authlib/authlib

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.