2012-06-25 8 views
24

※環境の詳細は下段に記載しています。基本認証チャレンジをレポートマネージャーURLに転送する方法

私は、レポートサービス用の認証ソリューションを構築しようとしています。

オンラインのcostumersは、既存のcostumerデータベースを使用して認証する必要がありますが、ローカルの管理ユーザーは単純な基本認証を使用することができます。

私はCodePlexの例を使用して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アクセス、入札レポートの展開、通常のアプリケーションではない)は、基本的なログオン/パスワードポップアップで挑戦されます。 /ReportServer URLにアクセスしたときにこれが正常に動作します

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); 
     } 
    } 
} 

を次のようにこれをサポートするために、私はHttpModuleをを作った、私は挑戦を受ける、/ハードコードされた管理者のログインを入力して合格し、ログオンします。要求はHTTPステータス401で失敗しました::

問題が/Reportsにアクセスするとき、私は

System.Net.WebException取得され 無断

を私は渡すことができる方法を知りたいですログイン/全面的にチャレンジする/Reports

私はSqlServer 2012とReporting Servi CES 2012が、内部の仕組みは、私は私のHttpModuleをのためのCodeGroupは私が

を持って rsreportserver.configではFullTrust

であるrssrvpolicy.config

<authentication mode="None" /> 
<identity impersonate="false" />, and the entry for the httpmodule 

を持っている私のweb.configSSRS 2008-R2

から変更されていません

<AuthenticationTypes> 
     <Custom/> 
    </AuthenticationTypes>, and the entry for the security extension 

まだSSLが設定されていません。バインディングはir default

+0

私はまだ答えが大好きですが、今のところ私は回避策を行っています。私のHttpModuleでは、ローカルマシンアクセスによるレポートマネージャへのアクセスのみを許可しています。ローカルマシンからアクセスするとき、コンテキストユーザーをadminとして設定しました。非常に醜い解決策ですが、解決策はありません。 –

+0

ReportManagerは同じ公開SOAP APIを使用してReportServerと通信するため、何らかの形でそれ自身を認証する必要があります。 ReportManagerの設定ファイルに同じモジュールを追加する必要があると思います。次に、ReportManagerが同じ認証Cookieまたは認証情報を使用してReportServerと通信することを願っています。 – user1578107

+0

カスタムセキュリティが可能です。 SSRSサービス・レベルでAuthenticateメソッドとAuthorizeメソッドをオーバーライドすると、ssrsマネージャーを使用して関数を組み込み、デフォルトのログイン・ページを提供するだけです。 –

答えて

4

エラーメッセージから、レポートマネージャーのUIのレンダリング時に認証エラーが発生したようです。 c:¥Program Files¥Microsoft SQL Server¥MSRS11.MSSQLSERVER¥Reporting Services¥ReportManager¥フォルダに移動し、web.configファイルを探して、次の変更を適用してください。

<authentication mode="None" /> 
<identity impersonate="false" />, and the entry for the httpmodule