box / box/box-java-sdk

Expose additional BoxAPIRequest/BoxAPIConnection members for request intercept use case

Đang mở
#488 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Java
Star
170
Fork
189
Merge trung bình
20 giờ 26 phút
Pull request đã merge (30 ngày)
22

Mô tả

In a Box SDK integration, I implemented a `com.box.sdk.RequestInterceptor` that uses its own HTTP client to send the requests over the network. Doing that, I noticed that in order to support this scenario, certain members should, in my opinion, be exposed to clients outside the SDK:
- `com.box.sdk.BoxAPIRequest.getHeaders()` should be public so that the corresponding content is accessible
- `com.box.sdk.BoxAPIRequest.shouldAuthenticate` should be exposed via a getter to distinguish the two cases that it indicates

In order to hold a read lock on the access token during the request (as `com.box.sdk.BoxAPIRequest.trySend(ProgressListener)` does), it would be necessary to also expose
- `com.box.sdk.BoxAPIConnection.lockAccessToken()` and
- `com.box.sdk.BoxAPIConnection.unlockAccessToken()`.

The access token can be obtained with the (already public) method `com.box.sdk.BoxAPIConnection.getAccessToken()`, but in this case there is no lock and the access token could be invalidated before the HTTP request is sent (or while it is being sent).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Xác định các khai báo của BoxAPIRequest và BoxAPIConnection, sau đó đọc BoxAPIRequest.trySend(ProgressListener), getHeaders() và cách xử lý access-token hiện có. Xác nhận interceptor cần phân biệt xác thực và duy trì khóa access-token như thế nào; hoàn thành có nghĩa là các member được yêu cầu có thể được truy cập từ bên ngoài mà không phá vỡ hành vi request hiện có.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
java
Lĩnh vực
api
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

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.