microsoftgraph / microsoftgraph/msgraph-sdk-java

Enable automatic token refresh when Continuous Access Evaluation (CAE) requires a new token

Offen
#2,306 11 Kommentare 9 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

status:waiting-for-triage type:bug
Vorherrschende Sprache
Java
Sterne
444
Forks
154
Ø Merge
18 Std. 28 Min.
Gemergte PRs (30 T.)
4

Beschreibung

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
  1. Configure authentication using ClientCertificateCredential and AzureIdentityAuthenticationProvider.
  2. Enable CAE in the Azure AD tenant.
  3. Call a Microsoft Graph API endpoint that requires authentication.
  4. 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?

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit AzureIdentityAuthenticationProvider und seiner Interaktion mit ClientCertificateCredential während Microsoft Graph API-Aufrufen. Reproduziere die CAE-Fehler und verfolge anschließend, wie der Provider die fehlgeschlagene Anfrage und den Token-Status verarbeitet. Als abgeschlossen gilt die Aufgabe, wenn durch CAE ausgelöste Authentifizierungsaktualisierungen automatisch erfolgen, ohne GraphServiceClient neu zu erstellen oder die Anwendung neu zu starten.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
azure, java
Bereich
api, authentication
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.