microsoftgraph / microsoftgraph/msgraph-sdk-java

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

Ouverte
#2,306 11 commentaires 9 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

status:waiting-for-triage type:bug
Langage dominant
Java
Étoiles
444
Forks
154
Merge moyen
18 h 28 min
PR mergées (30 j)
4

Description

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?

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par AzureIdentityAuthenticationProvider et son interaction avec ClientCertificateCredential lors des appels à Microsoft Graph API. Reproduisez les erreurs CAE, puis suivez la manière dont le provider gère la requête ayant échoué et l’état du token. Le travail est considéré comme terminé lorsque les actualisations d’authentification déclenchées par CAE s’effectuent automatiquement sans recréer GraphServiceClient ni redémarrer l’application.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
azure, java
Domaine
api, authentication
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
48/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.