0
我试图确定如何获取设置为针对本地ADFS服务器进行身份验证的MVC应用程序。我正在使用位于the Github Azure Samples处的Azure AD示例,并按照Vittorio Bertocci's blog中所述对其进行了修改,以使用我的应用的RealmId和我的组织的ADFS元数据端点。当我使用IIS Express运行示例时,会调用OWIN中间件,然后重定向到ADFS登录屏幕。在本地IIS中未调用ADFS OWIN身份验证
但是,我正在使用的应用程序需要在IIS中运行,因此我试图在本地IIS中配置示例应用程序。当我在本地IIS中运行示例时,没有重定向到ADFS,而是返回窗口(Kerberos)标识。我如何确保OWIN中间件由IIS调用?应用程序池以集成v4.0模式运行。
这是我Startup.Auth.cs代码:
private static string realm = ConfigurationManager.AppSettings["ida:Wtrealm"];
private static string metadata = ConfigurationManager.AppSettings["ida:ADFSMetadata"];
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
app.UseWsFederationAuthentication(
new WsFederationAuthenticationOptions
{
Wtrealm = realm,
MetadataAddress = metadata,
Notifications = new WsFederationAuthenticationNotifications
{
AuthenticationFailed = context =>
{
context.HandleResponse();
context.Response.Redirect("Home/Error?message=" + context.Exception.Message);
return Task.FromResult(0);
}
}
});
}
现在,除Windows身份验证外,我已禁用所有身份验证模式。这一定是问题所在,因为当我切换到只启用匿名时,它看起来像是重定向到ADFS。 – emaia