asp.net-mvc - 作为 ClaimsIdentity 的 HttpContext.User.Identity 为空
问题描述
我创建了一个 MVC 应用程序来使用 Sustainsys 集成 ADFS SSO。它在我的测试开发服务器中工作,但是当我尝试将它部署到不同的 IIS 服务器时。
工作应用程序在 Windows Server 2016 的 IIS 10 中部署。我被告知该 Web 服务器有一个 AD 服务器 linekd。我的 mvc 应用程序按预期工作正常,登录 adfs 后正在检索声明。这是一个测试开发服务器,所以我不能使用它,我得到了另一个开发服务器,我需要在其中部署 mvc 应用程序。
此服务器是 windows 2019,它没有附加任何 AD 服务器。我部署了 mvc 应用程序,就像我在另一台服务器中部署的方式一样,当我测试我的应用程序时,声明 ( HttpContext.User.Identity
) 为空。MVC 应用程序已在 ADFS 服务器中受信任。
在 web 配置中,我有 authentication = forms,它是我在sustainsys文档中遵循的设置。
我不确定我需要做什么配置才能使其工作,它与代码无关,因为它在本地工作并且在我部署到的第一台服务器中工作。
编辑:我有返回属性的 SAML 响应,
<AttributeStatement>
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress">
<AttributeValue>value</AttributeValue>
</Attribute>
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name">
<AttributeValue>value</AttributeValue>
</Attribute>
<Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn">
<AttributeValue>value</AttributeValue>
</Attribute>
<Attribute Name="Department">
<AttributeValue>Search</AttributeValue>
</Attribute>
</AttributeStatement>
解决方案
推荐阅读
- metasploit - 无法将 shell 升级到 Meterpreter 会话
- azure-vm - Restores.TriggerAsync 中的“由于参数无效或参数格式不正确,恢复操作失败”
- javascript - javascript中的字符串连接
- python - 如何修复错误 'UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 36188: character maps to
' - javascript - CORS 策略已阻止从源“null”访问 XMLHttpRequest?
- scroll - 如何在不滚动的父 div 中滚动子 div?
- java - 在“new String(..)”期间创建的无法访问的文字?
- python - 无法在 django 中对用户进行身份验证
- c - fopen() 在哪里搜索要读取的文件?
- c# - 在 C# 中重复位的有效方法是什么?