ASP.NET OWIN - 在运行时添加WsFederation

时间:2017-05-09 21:26:52

标签: c# asp.net adfs ws-federation

我想添加对管理员的支持,以便将受信任的联盟添加到我的网站。我试图在我的控制器中执行此操作,而无需使用以下命令重新启动Web应用程序:

app.Map("/Account", configuration =>
{
    var provider = new WsFederationAuthenticationOptions
    {
        AuthenticationType = organizationModel.ADFS_Domain,
        MetadataAddress = organizationModel.ADFS_MetadataAddress,
        BackchannelCertificateValidator = null,
        Wtrealm = organizationModel.ADFS_Realm,
        Wreply = serveraddress + " /Account/" + Guid.NewGuid().ToString(),
    };

     configuration.UseWsFederationAuthentication(provider);

});

上面的代码执行时没有错误,但是提供程序没有添加到Owin上下文中。主叫...

    HttpContext.GetOwinContext().Authentication.GetAuthenticationTypes()

不包含新选项...... :(

为了澄清,我可以在我的Startup.Auth.cs中做同样的事情,但同样,我不想重新启动主机...

有什么想法吗?

0 个答案:

没有答案