SSO 获取用户名/域
我正在尝试实施 SSO(单点登录),但无法获得正确的用户名。
在我的地方,当我检索当前登录的用户时,我得到:USER@DOMAIN
。这是正确的。当在客户处执行相同的代码时,它返回:USER@DOMAIN
。但在那种情况下;这是不正确的。客户的预期价值为[电子邮件受保护].
我对 SSO 不太熟悉,无法谈论 INTRANET 部分。在客户处,其他软件也使用 SSO,因此需要“我的”软件将用户/域格式化为 [电子邮件受保护]
。
我已经尝试了几段代码来检索当前登录用户的用户/域。以下结果来自客户。
UserPrincipal.Current.UserPrincipalName - returns user@domain
System.Environment.UserDomainName - returns INTRANET
WindowsIdentity.GetCurrent.Name - returns INTRANET\user
因此,我正在寻找一种方法来检索当前登录用户的完整用户名以及“子域”(内联网)。有人知道我做错了什么吗?
*编辑:*我重新表述了我的问题。我感觉我的英语一天比一天差...:S
I'm trying to implement SSO (Single Sign On) but I can't get the correct username.
At my place, when I retrieve the currently logged on user I get: USER@DOMAIN
. Which is correct. When the same code is executed at the customer, it returns: USER@DOMAIN
. But in that situation; it is not correct. The expected value at the customer is [email protected]
.
I'm not familiar enough with SSO to say anything about the INTRANET part. At the customer, other software uses SSO as well and therefore it is required that 'my' software formats the user/domain into [email protected]
.
I've tried several pieces of code to retrieve the user/domain of the currently logged in user. The results below are from the customer.
UserPrincipal.Current.UserPrincipalName - returns user@domain
System.Environment.UserDomainName - returns INTRANET
WindowsIdentity.GetCurrent.Name - returns INTRANET\user
So I'm looking for a way to retrieve the complete username of the currently logged in user with the 'subdomain' (INTRANET) as well. Does anybody know what I'm doing wrong?
*Edit: * I rephrased my question. I feel like my English is getting worse by day... :S
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下代码。
Try following code.