Azure-Samples / ms-identity-java-desktop

A desktop application in Java calling Microsoft Graph API
MIT License
23 stars 23 forks source link

Sample Enhancements #6

Closed SomkaPe closed 4 years ago

SomkaPe commented 4 years ago
  1. Demonstrated implementation on ITokenCacheAccessAspect does not make much sense.

Token cache is initialized from file with "dummy data", after it, in-memory "data" defined in TokenCacheAspect is used. So file is used to read "dummy data" and it is never updated. That does not make sense.

Using in-memory cache defined in TokenCacheAspect is pointless, because MSAL application has its own in-memory token cache.

I do not think we should show how to implement persistent cache in scope of this sample, it is quite complicated and should :

demonstrate real use case ( as I explained current implementation does not make sense ) cover security concurrency

So I believe it is enough to use in-memory cache for the purpose of this sample

  1. Application configurations should be in separate properties file, hardcoding config is anti pattern.
navyasric commented 4 years ago

Use the pattern of acquiring token silently first followed by the acquire token with interaction call.