首页 > 解决方案 > 如何在 SSRS 2016 中添加自定义身份验证 - 使用 ADFS 和 OWIN

问题描述

我正在努力在 SSRS 2016 之上添加自定义身份验证。有一篇非常好的文章可以做同样的事情

自定义 SecuritySample 2016 - https://github.com/Microsoft/Reporting-Services/tree/master/CustomSecuritySample2016

Microsoft 提供的添加自定义身份验证的步骤基本上是添加表单身份验证,其中将用户名/密码作为 logon.aspx 上的输入。我这样做了,它按预期工作。但我的要求是使用 ADFS(Active Directory 联合服务)对用户进行身份验证。幸运的是,dotnetcurry.com/windows-azure/1166/aspnet-mvc-multiple-adfs-owin-katana 上还有另一篇好文章

感谢上面的文章,我能够在示例 MVC Web 表单应用程序中使用 ADFS 和 OWIN 进行身份验证。

但问题是,当我尝试将上述示例登录添加到 Microsoft 提供的自定义安全示例中时(上面提供的链接)。我遇到了一个例外

引发了“System.Web.HttpUnhandledException”类型的异常。
在上下文中找不到 owin.Environment 项。

所以这就是我正在做的事情。

我在 GitHub 上提供的https://github.com/Microsoft/Reporting-Services/tree/master/CustomSecuritySample2016解决方案中添加了 Startup.cs 文件。然后还在 App_Start 文件夹下添加了 Startup.Auth.cs 文件。修改 web.config 文件以添加以下设置。

<add key="owin:AppStartup" value="Microsoft.Samples.ReportingServices.CustomSecurity.Startup, Microsoft.Samples.ReportingServices.CustomSecurity" />
<add key="owin:AutomaticAppStartup" value="true" />
  1. 然后在 Logon.aspx 的 Page_Load 事件上,我只是试图通过扩展 HttpContext 来访问 GetOwinContext 方法。

私人无效页面加载(对象发送者,System.EventArgs e)
{

var ct = HttpContext.Current.GetOwinContext();

}

  1. 其余更改与 GitHub 上的自定义安全示例 2016 代码中提到的完全相同(上面的链接)。

我已经用谷歌搜索了这个例外,我已经根据正确的答案添加了这个设置,但我的仍然给出这个例外。

<add key="owin:AppStartup" value="Microsoft.Samples.ReportingServices.CustomSecurity.Startup, Microsoft.Samples.ReportingServices.CustomSecurity" />
<add key="owin:AutomaticAppStartup" value="true" />

是因为 SSRS 不允许加载任何未在 RSReportServer.config 中添加的 DLL?

标签: asp.netauthenticationreporting-serviceswebformsowin

解决方案


推荐阅读