※環境の詳細は下部に記載しております。
レポートサービスの認証ソリューションを構築しようとしています。
オンラインのコスチュームは、既存のコスチュームデータベースを使用して認証する必要がありますが、ローカル管理ユーザーは、単純な基本認証を使用できます。
私はコードプレックスの例を使用するためのセキュリティ拡張を行いましSSRS
た。基本的な課題を発行するために使用する方法は次のとおりです。
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;
}
これにより、メソッドを通過していないユーザー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"];
if (!string.IsNullOrEmpty(basicAuth))
{
var loginpass = Encoding.Default.GetString(
Convert.FromBase64String(basicAuth.Replace("Basic ", ""))).Split(':');
if (loginpass.Length == 2
&& loginpass[0] == adminUser
&& loginpass[1] == adminPass)
{
app.Context.User = new GenericPrincipal(
new GenericIdentity(adminUser), null);
}
}
}
これは/ReportServer
、URLにアクセスするときに正常に機能します。チャレンジされ、ハードコードされた管理者ログイン/パスを入力してログオンします。
問題は、アクセスするとき/Reports
に取得することです
System.Net.WebException:リクエストはHTTPステータス401:Unauthorizedで失敗しました
ログイン/パスチャレンジをに渡す方法を知りたい/Reports
SqlServer2012をReportingServices2012と一緒に実行していますが、内部の動作はSSRS 2008-R2
私のweb.config
中に
<authentication mode="None" />
<identity impersonate="false" />, and the entry for the httpmodule
私のhttpmodulerssrvpolicy.config
のコードグループにはFullTrustがあります
私rsreportserver.config
は持っています
<AuthenticationTypes>
<Custom/>
</AuthenticationTypes>, and the entry for the security extension
まだ構成していませんがSSL
、バインディングはデフォルトになっています