Forms Authentication in Reporting Services

martedì 10 febbraio 2009 - 11.07

volperubbia Profilo | Senior Member

Ciao a tutti,
nella mia applicazione asp.net 2.0 ho una pagina di accesso a reporting services,
dove un utente loggato vede in una drop down list l'elenco dei reports disponibili
e quindi il report selezionato viene agganciato al report viewer.
Vorrei ora impostare la Forms Authentication su Reporting Services, come procedere?

Sul web.config del reports server ho impostato:
<authentication mode="Forms" />
<identity impersonate="false" />

E su rsreportserver.config:
<Security>
<Extension Name="Forms" Type="Microsoft.ReportingServices.Authorization.FormAuthorization, Microsoft.ReportingServices.Authorization" />
</Security>

Serve altro?

A queesto punto mi sono creato la seguente classe.

Imports Microsoft.Reporting.WebForms
<Serializable()> _
Public NotInheritable Class MyReportServerCredentials
Inherits System.Net.NetworkCredential : Implements IReportServerCredentials
Public ReadOnly Property ImpersonationUser() As System.Security.Principal.WindowsIdentity Implements IReportServerCredentials.ImpersonationUser
Get
Return Nothing
End Get
End Property
Public ReadOnly Property NetworkCredentials() As Net.ICredentials Implements IReportServerCredentials.NetworkCredentials
Get
Return New Net.NetworkCredential
End Get
End Property
Public Function GetFormsCredentials(ByRef authCookie As Net.Cookie, _
ByRef userName As String, _
ByRef password As String, _
ByRef authority As String) As Boolean Implements IReportServerCredentials.GetFormsCredentials
Return True
End Function
End Class

Pensavo di usarla nel seguente modo:

Private m_objRS As New ReportingServices.ReportingService
...
...
m_objRS.Url = "http://localhost/ReportServer/ReportService.asmx"
m_objRS.Credentials = New MyReportServerCredentials
...
For Each report As ReportingServices.CatalogItem m_objRS.ListChildren("...", True)
If (report.Type = ReportingServices.ItemTypeEnum.Report) Then ddlReport.Items.Add(...)
Next

e poi
Me.rsViewer.ServerReport.ReportServerCredentials = New MyReportServerCredentials()
Me.rsViewer.ServerReport.ReportServerUrl = New System.Uri(...)
Me.rsViewer.ServerReport.ReportPath = "/"c & ReportPath & "/"c & Me.ddlReport.SelectedItem.Value

Non so se quest'ultima parte funziona, perchè l'applicazione non riesce neppure a popolarmi
la ddl, probabilmente mi son perso qualche passaggio. In pratica ciò che vorrei ottenere è:
1) l'utente accede al sito e si autentica (Forms Authentication del sito)
2) l'utente autenticato accede alla pagina protetta dei reports (il cookie è quello del sito)
3) l'utente può vedere l'elenco dei reports (ReportingServices.ReportingService) e accedere al singolo reports (report viewer),
senza fornire ulteriori credenziali ...

Qualche idea?

Grazie per l'attenzione,
Davide
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5