-
Notifications
You must be signed in to change notification settings - Fork 152
Closed
Labels
BugSomething isn't working, needs an investigation and a fixSomething isn't working, needs an investigation and a fixRequires more infoMore information is needed, from either the person who opened the issue or another teamMore information is needed, from either the person who opened the issue or another teampublic-clientFor questions/issues related to public client appsFor questions/issues related to public client apps
Description
Steps to reproduce
- Run the example at https://github.com/AzureAD/microsoft-authentication-library-for-java/blob/dev/msal4j-sdk/src/samples/public-client/UsernamePasswordFlow.java using the details of an account that has no
localAccountId
.- Note that localAccountId seems to be only required on JS's account structure microsoft-authentication-library-for-js#3336 suggests that a localAccountId is not always created.
Expected results
- New token is generated, and then re-used as it's in the cache
Actual results
- New token is generated, then an NPE occurs as there is no
localAccountId
and the following statement throws an NPE;if (accCached.homeAccountId().contains(accCached.localAccountId())) {
==No accounts in cache
17:46:47.494 [ForkJoinPool.commonPool-worker-3] DEBUG com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: cd8843c4-5fc5-4d42-9d65-e6e7675f042b] Execution of class com.microsoft.aad.msal4j.AcquireTokenSilentSupplier failed.
com.microsoft.aad.msal4j.MsalClientException: Token not found in the cache
at com.microsoft.aad.msal4j.AcquireTokenSilentSupplier.execute(AcquireTokenSilentSupplier.java:75)
at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:69)
at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:18)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
==acquireTokenSilently call failed: com.microsoft.aad.msal4j.MsalClientException: Token not found in the cache
17:46:47.565 [ForkJoinPool.commonPool-worker-3] DEBUG com.microsoft.aad.msal4j.TokenRequestExecutor - Sending token request to: https://adfs.mbtest.bt.com/adfs/
17:46:48.867 [ForkJoinPool.commonPool-worker-3] DEBUG com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: 48f8b765-57e0-44b6-8325-20d9f97b2272] Access Token and Refresh Token were returned
==username/password flow succeeded
Account username: **REDACTED**
Access token: **REDACTED**
Id token: **REDACTED**
17:46:48.882 [ForkJoinPool.commonPool-worker-3] ERROR com.microsoft.aad.msal4j.PublicClientApplication - [Correlation ID: 865566e9-a1d5-444f-b364-976f46a9b953] Execution of class com.microsoft.aad.msal4j.AccountsSupplier failed.
java.lang.NullPointerException: null
at java.base/java.lang.String.contains(String.java:2036)
at com.microsoft.aad.msal4j.TokenCache.getAccounts(TokenCache.java:349)
at com.microsoft.aad.msal4j.AccountsSupplier.get(AccountsSupplier.java:26)
at com.microsoft.aad.msal4j.AccountsSupplier.get(AccountsSupplier.java:11)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Metadata
Metadata
Assignees
Labels
BugSomething isn't working, needs an investigation and a fixSomething isn't working, needs an investigation and a fixRequires more infoMore information is needed, from either the person who opened the issue or another teamMore information is needed, from either the person who opened the issue or another teampublic-clientFor questions/issues related to public client appsFor questions/issues related to public client apps