2011-03-10 4 views
4

Windows 인증 대신 폼 인증을 허용하기 위해 SSRS 2008 (R2 아님)에 일부 사용자 지정 보안 코드를 구현하려고합니다. 필자는 Microsoft 솔루션을 Microsoft 샘플 코드에 기반을두고 있으며 그 대부분을 정상적으로 작동하도록했습니다. 문제가있는 유일한 영역은 실제 Report Manager URL에 로그온하는 경우입니다.어떻게이 SSRS 인증 예외를 해결할 수 있습니까?

문제 1 는 (은 Microsoft 예제의 지시에 따라) 내가 /Pages 폴더에 복사 한 UILogon.aspx 페이지를 선택하지 않는 URL http://localhost/Reports_MSSQL2008/를 사용하여. 여전히 기쁨을 내가 영문 파일의 정확한 경로와 일치하도록 경로를 변경 시도

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

하지만 !! : 나는 다음과 같은 포함하도록 ReportManager 폴더에있는 Web.config의 개정 없었다 때문에 위의 문제의

문제 2 , 나는 그냥 URL, http://localhost/Reports_MSSQL2008/Pages/UILogon.aspx를 통해 UILogon와 ReportManager에 점점 시도했다. 이것은 내가 내 사용자 지정 코드 (UILogon.aspx.cs 및 IAuthorisation/IAuthentication 코드)로 단계로 얻을에서 작동하고 난 다음 그 일을 볼 수 있습니다

  • 인증/사용자
  • 권한을 부여 쿠키를 만드는

문제점 인 /Folder.aspx 페이지에 Response.Redirect를 수행 응답/요청 쿠키 용기

  • 에 쿠키 (sqlAuthCookie)를 저장할 때 Response.Redirect를 COM 다시 GetUserInfo() 메서드로 반환하면 HttpContext.Current.User는 null이고 더 이상 쿠키가 없습니다. 이런 널 IIdentity가 반환되기 때문에 (캔트! 아무것도로 설정) 및 SSRS 오류가 발생합니다 ...

    Microsoft.ReportingServices.Diagnostics.Utilities.AuthenticationExtensionException :
    Authentication (인증) 확장 던진 예기치 않은 예외가 발생했거나 유효하지 않은 값이 반환되었습니다. identity == null.

    정보 - 보고서 작성기/Visual Studio bi proj/웹 서비스 URL을 실행하면 정확하게 필요한 작업을 수행하고 정상적으로 작동합니다. 문제를 일으키는 보고서 관리자 일뿐입니다.

    <authentication mode="Forms" /> 
    

    : 단지의 Web.config에 다음을

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

    과 :

    내가 지금 그것을 해결 한
  • +0

    Microsoft sa는 어디에 있습니까? 이걸 세팅하기위한 mples? – BSick7

    +0

    필자가 찾은 최고의 예가 http://www.devx.com/dotnet/Article/26759/0/page/1 링크를 사용하십시오. 또한 http://www.devx.com/dotnet/Article/27133에 그것의 부분 2가 있습니다. – Markleesy1

    답변

    4

    .... 나는하여하여 RSReportServer.config에 다음을 추가했다 또한 GetUserInfo()에서 반환 된 null Identity에 대한 안전을 위해 다음 코드를 작성했습니다.

    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; 
    } 
    
    관련 문제