microsoftgraph / microsoftgraph/msgraph-sdk-java
Enable automatic token refresh when Continuous Access Evaluation (CAE) requires a new token
還沒有人認領這個 Issue。
- 主要語言
- Java
- 星號
- 444
- 分支
- 154
- 平均合併
- 18 小時 28 分鐘
- 30 天內合併 PR
- 4
描述
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?
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 AzureIdentityAuthenticationProvider 及其在 Microsoft Graph API 呼叫期間與 ClientCertificateCredential 的互動開始。重現 CAE 錯誤,然後追蹤 provider 如何處理失敗的要求和權杖狀態。當 CAE 觸發的驗證更新能夠自動進行,而不需要重新建立 GraphServiceClient 或重新啟動應用程式時,即表示完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- azure, java
- 領域
- api, authentication
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 活躍
- 描述清晰度
- 基本清楚
- 新手友好度
- 48/100