【问题标题】:SSRS 2016 Custom AuthenticationSSRS 2016 自定义身份验证
【发布时间】:2017-12-29 05:36:12
【问题描述】:
我有一个 mvc 应用程序,它从报表服务器构建报表,它通过流读取内容。现在我需要做的是为 SSRS2016 创建一个 CustomAuthentication,以便我可以自动以访客用户身份登录(目前,凭据保存在配置中)。每个解释 CustomAuthentication 的“操作方法”的链接都有一个登录页面。
我需要创建那个吗?
我知道我应该使用 IAuthenticationExtension,但我不希望用户登录服务器,也没有包含用户名和密码的数据库,因为大多数来源都使用这样的数据库。
如果我不需要创建页面,传统 LogonUser(string userName, string password, string auth) 的替代方法是什么?
【问题讨论】:
标签:
asp.net-mvc
reporting-services
ssrs-2016
【解决方案1】:
看看这个link 是否有帮助。
或者试试这样的。
internal class ReportCredentials : IReportServerCredentials
{
private string strUserName;
private string strPassword;
private string strDomain;
public ReportCredentials(string strUserName, string strPassword, string strDomain)
{
this.strUserName = strUserName;
this.strPassword = strPassword;
this.strDomain = strDomain;
}
public System.Security.Principal.WindowsIdentity ImpersonationUser
{
get { return null; }
}
public ICredentials NetworkCredentials
{
get { return new NetworkCredential(strUserName, strPassword, strDomain); }
}
public bool GetFormsCredentials(out Cookie authCookie, out string user,
out string password, out string authority)
{
authCookie = null;
user = password = authority = null;
return false;
}
}
还有这个
string strUserName = ConfigurationManager.AppSettings["userName"].ToString();
string strPassword = ConfigurationManager.AppSettings["password"].ToString();
string strDomain = ConfigurationManager.AppSettings["domain"].ToString();
ReportViewer1.ServerReport.ReportServerCredentials = new ReportCredentials(strUserName, strPassword, strDomain);