microsoft / msopentech-tools-for-intellij

Plugin for easy and fast development to enable developers of Android Apps to connect to Office 365 services and Azure Mobile Services, and developers of Java middleware to connect to Azure compute services
Apache License 2.0
28 stars 34 forks source link

Combine authentication check with token retreival in `AADManagerImpl` #364

Open avranju opened 9 years ago

avranju commented 9 years ago

The AADManagerImpl class has multiple methods that check whether the user has already authenticated or has a valid refresh token handy before deciding to continue on different code paths which tend to proceed to then acquire an access token or redeem a refresh token. This process results in acquisition and release of the same set of thread locks and multiple identical map lookups. Since these methods are likely to be called frequently it might make sense to combine the currently separate calls to check for availability of tokens and their subsequent retrieval into a single call.