ADAL python 支持 windows 登录用户

ADAL python support for windows logged in user

我们目前正在使用 adal python 库,想知道是否有任何方法(或实施方法的计划)使用登录用户 (windows) 进行联合身份验证流程。

使用 .Net 包可以实现这样的流程 link

最终目标可能是 acquire_token_with_signed_in_user?

,而不是 acquire_token_with_username_password

您可以使用acquire_token_with_username_password方法获取accessToken和refreshToken。根据以下文档,没有使用登录用户获取令牌的方法,但您可以使用 acquire_token_with_refresh_token 通过使用刷新令牌来获取新的访问令牌你接到了第一个电话。您可以使用 TokenCache class 来缓存 accessToken 和 refreshToken。

Refresh Token in adal pythonhttps://adal-python.readthedocs.io/en/latest/

希望对您有所帮助。

感谢您对这个有价值的问题所做的研究(已投票)!

确实,在我们进行未来几轮规划时,ADAL Python 和它的同类 MSAL Python supports "picking up windows signed-in user and use it". That feature is known as IWA, traditionally only available in our .Net/C# SDK on Windows platforms. It is theoretically possible to add that into Python too. We don't currently have it in our roadmap, largely because no one asks for it before. In that sense, feel free to go ahead and create an issue for it in our MSAL Python github repo (and you did), so that people in the world (or your spouse) can upvote it, and then we will sort them by +1 votes 都没有。

另一方面,已经有一个 token cache behavior in ADAL Python and in MSAL Python. If you utilize it, and also build your own persistence layer on top of it (which is very easy in MSAL Python),您可以缓存令牌,这样您的最终用户就不需要每次都进行身份验证。 PS:正在努力为令牌缓存持久性提供更高级别的帮助程序,但这是一个不同的主题。

也感谢@mohitdhingra-msft 在这里提供了另一个正确的答案。