microsoftgraph / microsoftgraph/msgraph-sdk-java
Enable automatic token refresh when Continuous Access Evaluation (CAE) requires a new token
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 444
- Fork
- 154
- Merge trung bình
- 18 giờ 28 phút
- Pull request đã merge (30 ngày)
- 4
Mô tả
Describe the bug
When using the AzureIdentityAuthenticationProvider with ClientCertificateCredential, the authentication process does not automatically refresh the token when CAE forces a new authentication. This results in InteractionRequired and TokenCreatedWithOutdatedPolicies errors during Microsoft Graph API calls.
Expected behavior
The AzureIdentityAuthenticationProvider should detect when CAE requires a new token and automatically refresh it to prevent authentication failures.
How to reproduce
- Configure authentication using ClientCertificateCredential and AzureIdentityAuthenticationProvider.
- Enable CAE in the Azure AD tenant.
- Call a Microsoft Graph API endpoint that requires authentication.
- If CAE enforces a re-authentication, the request fails with the error:
Continuous access evaluation resulted in challenge with result: InteractionRequired and code: TokenCreatedWithOutdatedPolicies
SDK Version
6.26.0
Latest version known to work for scenario above?
No response
Known Workarounds
Manually regenerating the GraphServiceClient instance or completely restarts the application.
Debug output
The provider does not refresh the token, causing repeated authentication errors when CAE is triggered.
Caused by: com.microsoft.graph.models.odataerrors.ODataError: Continuous access evaluation resulted in challenge with result: InteractionRequired and code: TokenCreatedWithOutdatedPolicies
at com.microsoft.graph.models.odataerrors.ODataError.createFromDiscriminatorValue(ODataError.java:36)
at com.microsoft.kiota.serialization.JsonParseNode.getObjectValue(JsonParseNode.java:212)
at com.microsoft.kiota.http.OkHttpRequestAdapter.lambda$throwIfFailedResponse$0(OkHttpRequestAdapter.java:673)
at com.microsoft.kiota.ApiExceptionBuilder.<init>(ApiExceptionBuilder.java:26)
at com.microsoft.kiota.http.OkHttpRequestAdapter.throwIfFailedResponse(OkHttpRequestAdapter.java:672)
at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:280)
at com.microsoft.graph.sites.item.drive.DriveRequestBuilder.get(DriveRequestBuilder.java:59)
at com.microsoft.graph.sites.item.drive.DriveRequestBuilder.get(DriveRequestBuilder.java:46)
Configuration
Microsoft Graph SDK version: 6.26.0
Java version: 21
Spring Boot version: 3.3
Authentication method: ClientCertificateCredential
Other information
Manually regenerating the GraphServiceClient instance as a workaround is inefficient. It would be beneficial if the SDK could handle this scenario internally.
Would it be possible to enhance AzureIdentityAuthenticationProvider to handle CAE-related token refresh automatically?
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.
Hướng nghiên cứu
Bắt đầu với AzureIdentityAuthenticationProvider và sự tương tác của nó với ClientCertificateCredential trong các lệnh gọi Microsoft Graph API. Tái hiện các lỗi CAE, sau đó theo dõi cách provider xử lý yêu cầu không thành công và trạng thái token. Hoàn thành khi việc làm mới xác thực do CAE kích hoạt diễn ra tự động mà không cần tạo lại GraphServiceClient hoặc khởi động lại ứng dụng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- azure, java
- Lĩnh vực
- api, authentication
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 48/100