feat(remote): make the OAuth2 client authentication method configurable per service
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 49/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- go
- Lĩnh vực
- authentication
Hướng nghiên cứu
Start with remote/auth/oauth2.go and the OAuth2Config definition, then trace how endpoint_params is validated and how OAuth2 token requests are built. Add coverage for the default and client_secret_post behavior, plus invalid values at config load; done means existing services retain basic authentication and the new method places credentials in the form body without an Authorization header.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The OAuth2 authenticator always authenticates with client_secret_basic — credentials form-url encoded into an Authorization header (auth/oauth2.go):
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
// Authenticate with client_secret_basic (RFC 6749 §2.3.1) ...
req.SetBasicAuth(url.QueryEscape(a.clientID), url.QueryEscape(a.clientSecret))
That is the right default — RFC 6749 §2.3.1 recommends it, and every service in the registry today works with it. But it is the only method available, so a provider that requires client_secret_post (credentials as parameters in the request body, also permitted by §2.3.1) cannot be reached through the registry at all. The caller has to hand-roll a token exchange outside core/remote, losing the caching, refresh margin and secret resolution the authenticator already provides.
Proposal
One optional field on OAuth2Config, defaulting to the current behaviour:
"auth": {
"type": "oauth2",
"options": {
"token_url": "https://provider.example/token",
"client_id": "…",
"client_secret": "env:PROVIDER_SECRET",
"client_auth_method": "client_secret_post"
}
}
client_secret_basic(default when the field is absent) — unchanged behaviour for every existing service.client_secret_post—client_idandclient_secretadded to the form body, noAuthorizationheader.
Naming follows RFC 6749 §2.3.1 and OpenID Connect Discovery's token_endpoint_auth_methods_supported, so the config value is the same string a provider's discovery document advertises.
Worth validating the value at config load rather than at first token request, as endpoint_params already does — a typo should fail when services are loaded, not on the first outbound call in production.
Context
This surfaced while integrating the SLPA Cargo Management System from nsw-srilanka. Its published example posts credentials in a JSON body, which suggested the standard form shape would not work. Testing showed all three shapes are accepted there — client_secret_basic, client_secret_post, and JSON — so that integration needs nothing from this issue and ships on the current default.
I prototyped the change locally (~150 lines including tests: the config field, a single request builder differing only in credential placement, and validation) and reverted it, since nothing in flight requires it. Happy to open the PR if the design above looks right.
Not proposed
private_key_jwt and client_secret_jwt — no caller needs them, and they bring key management with them. Rejecting unknown values at load leaves room to add them later.
- Ngôn ngữ chính
- Go
- Star
- 6
- Fork
- 8
- Merge trung bình
- 21 giờ 36 phút
- Pull request đã merge (30 ngày)
- 42
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
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 OpenNSW/core
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
payment: test fixtures hardcode real gateway names (govpay/lankapay) instead of generic placeholdersĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/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 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
nsw-sl cleanup Type/Improvement
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
remote: let the host inject a logger, and log with one consistent policyCó thể đã có người làm @mushrafmim đã nhận 5 ngày trước. Đang mởType/Improvement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 22/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
agent-research-finding chore
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jordansmall/spindrift#7370 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
☢️ Bug v3
Độ 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
-
The repo's gates check is clean and runs need no swapsCó thể đã có người làm @turbot-agent-fleet đã nhận hôm nay. Đang mởagent:ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
turbot/tailpipe#677 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-kind needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
crossplane-contrib/provider-keycloak#806 ·
Maintainer thường phản hồi trong vòng 1 ngày