Is AcquireTokenAsync thread-safe?

。_饼干妹妹 提交于 2020-03-03 05:42:04

问题


I am using ADAL's (Microsoft.IdentityModel.Clients.ActiveDirectory v4.3.0) AuthenticationContext.AcquireTokenAsync to acquire a bearer token with a ClientCredential.

I am creating a new AuthenticationContext to acquire a token for each request. Is that thread-safe? Or do I have to lock the call to AcquireTokenAsync with a static SemaphoreSlim?

I am asking because according to http://www.cloudidentity.com/blog/2013/10/01/getting-acquainted-with-adals-token-cache/ the method uses a static token cache which is not thread-safe, but the article is quite old and I haven't found any more up-to-date information.


回答1:


ADAL.NET v4.3 can not at this point in time be considered thread safe. We are working towards this with MSAL v2+.



来源:https://stackoverflow.com/questions/52992009/is-acquiretokenasync-thread-safe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!