我在使用WsFederation AuthenticationMVC Web应用程序时遇到登录循环问题.我用Visual Studio来创建Web应用程序的脚手架和来设置WsFederation的Startup.cs.这会生成以下代码块:
public class Startup
{
private static string realm = ConfigurationManager.AppSettings["ida:Wtrealm"];
private static string adfsMetadata = ConfigurationManager.AppSettings["ida:ADFSMetadata"];
public void Configuration(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseWsFederationAuthentication(new WsFederationAuthenticationOptions
{
Wtrealm = realm,
MetadataAddress = adfsMetadata
});
}
}
Run Code Online (Sandbox Code Playgroud)
Web应用程序托管在Azure中,ADFS位于内部.
在某些客户端上,当进行登录尝试时,登录页面进入循环,请求新令牌在ADFS服务器上导致以下异常:
异常详细信息:Microsoft.IdentityServer.Web.InvalidRequestException:MSIS7042:同一客户端浏览器会话在最后"7"秒内发出了"6"个请求.请联系您的管理员了解详情
我已经阅读了很多关于StackOverflow的文章,并查看了编写IdentityServer的人提供的各种示例,我尝试了各种配置选项,我无法将问题隔离到特定区域.
从我读到的内容来看,OWIN中间件丢失了对象的上下文,因此令牌"丢失".
我试图实现其他一些在StackOverflow上提供的示例代码但是,我似乎找不到解决方案来解决我的问题或者可能没有正确实现代码.
有任何想法吗?