*底部描述了环境的详细信息.
我正在尝试为报告服务构建身份验证解决方案.
应使用我们现有的costumer数据库对在线客户进行身份验证,而本地管理用户可以使用简单的基本身份验证.
我已经SSRS使用codeplex示例进行了安全扩展,我用来发出基本挑战的方法如下
public void GetUserInfo(out IIdentity userIdentity, out IntPtr userId)
{
if (HttpContext.Current != null && HttpContext.Current.User != null)
userIdentity = HttpContext.Current.User.Identity;
else
{
HttpContext.Current.Response
.AddHeader("WWW-Authenticate", "Basic realm=\"ReportServer\"");
HttpContext.Current.Response.Status = "401 Unauthorized";
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.Close();
userIdentity = new GenericIdentity("not authorized");
}
userId = IntPtr.Zero;
}
Run Code Online (Sandbox Code Playgroud)
这样,当没有通过该LogonUser方法的用户(即直接URL访问,出价报告部署,而不是常规用户应用程序)受到基本登录/密码弹出窗口的挑战时.为了支持这一点,我制作了如下的httpmodule
void IHttpModule.Init(HttpApplication context)
{
context.AuthenticateRequest += CustomAuthenticateRequest;
}
void CustomAuthenticateRequest(object sender, EventArgs e)
{
var app = sender as HttpApplication;
if (app == null) return;
var basicAuth = app.Context.Request.Headers["Authorization"]; …Run Code Online (Sandbox Code Playgroud)