4

カスタム セキュリティ コードを SSRS 2008 (R2 ではない) に実装して、Windows 認証の代わりにフォーム認証を許可しようとしています。私はマイクロソフトのサンプル コードに基づいてソリューションを作成し、そのほとんどを完全に正常に動作させることができました。私が問題を抱えている唯一の領域は、実際の Report Manager URL にログオンするときです。

問題 1 URL を使用すると、フォルダーにコピーしhttp://localhost/Reports_MSSQL2008/たページが取得されません(Microsoft の例の指示に従って)。ReportManager フォルダーの web.config を修正して、次の内容を含めました。UILogon.aspx/Pages

<authentication mode="Forms">
  <forms loginUrl="UILogon.aspx" 
         name="sqlAuthCookie" 
         timeout="60" 
         slidingExpiration="true" 
         path="/" />
</authentication>

aspxファイルの正確なパスに一致するようにパスを変更しようとしましたが、まだ喜びはありません!!

問題 2 上記の問題のため、URL 経由で UILogon と ReportManager にアクセスしようとしましたhttp://localhost/Reports_MSSQL2008/Pages/UILogon.aspx。これは、カスタム コード (UILogon.aspx.cs および IAuthorisation / IAuthentication コード) にステップ インするという点で機能し、次のように実行されていることがわかります。

  • ユーザーの認証/承認
  • クッキーの作成
  • 応答/要求 Cookie コンテナに Cookie (sqlAuthCookie) を格納する
  • /Folder.aspx ページへの response.redirect の実行

問題は、response.redirect が GetUserInfo() メソッドに戻ると、HttpContext.Current.User が null になり、Cookie がなくなることです。このため、null IIdentity が返され (他のものに設定できません!!)、SSRS はエラーをスローします...

Microsoft.ReportingServices.Diagnostics.Utilities.AuthenticationExtensionException:
認証拡張機能が予期しない例外をスローしたか、無効な値を返しました: identity==null.

情報については、レポート ビルダー/Visual Studio bi proj/Web サービス URL を起動すると、必要なことを正確に実行し、正常に動作します...問題を引き起こしているのはレポート マネージャーだけです。

4

1 に答える 1

5

私は今それを解決しました....私はrsreportserver.configに以下を追加しなければなりませんでした:

<UI>
    <CustomAuthenticationUI>
        <loginUrl>/Pages/UILogon.aspx</loginUrl>
    <UseSSL>false</UseSSL> 
    </CustomAuthenticationUI>
    <ReportServerUrl></ReportServerUrl>
    <PageCountMode>Estimate</PageCountMode>
</UI>

web.configには次のものだけがあります。

<authentication mode="Forms" />

また、GetUserInfo()からnull IDが返されるのを防ぐために、次のようにコーディングしました。

public void GetUserInfo(out IIdentity userIdentity, out IntPtr userId)
{
    //default the userIdentity
    userIdentity = new GenericIdentity(WindowsIdentity.GetCurrent().Name);

    // If the current user identity is not null,
    // set the userIdentity parameter to that of the current user 
    if (HttpContext.Current != null
          && HttpContext.Current.User != null)
    {
        userIdentity = HttpContext.Current.User.Identity;
    }

    // initialize a pointer to the current user id to zero
    userId = IntPtr.Zero;
}
于 2011-03-10T13:59:40.610 に答える