【发布时间】:2020-10-21 21:36:20
【问题描述】:
我正在开发一个 C# WPF 应用程序,该应用程序需要根据当前用户的 Windows 域登录来对其进行授权。用户不需要输入他的用户名/密码,只要他的用户帐户运行应用程序,应用程序就会授权他。
我通过简单地使用System.Security.Principal 查询当前用户的凭据来实现这一点,如下所示:
System.Security.Principal.WindowsIdentity CallerWindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent();
string username = CallerWindowsIdentity.Name;
// Then, I simply look up the username in my database
问题:今天我的客户要求我使其与来自 ADFS(Active Directory 联合服务)和 Azure Active Directory 的用户兼容。
我有点老派编码员。我的知识一直围绕着本地 Windows Server Active Directory。
我的代码会与这些新技术兼容吗?还是我必须重做登录机制?
【问题讨论】:
标签: c# azure active-directory azure-active-directory windows-authentication