Udostępnij za pośrednictwem


Metoda IAuthenticationExtension.GetUserInfo

Zwraca bieżącą tożsamość użytkownika.

Przestrzeń nazw:  Microsoft.ReportingServices.Interfaces
Zestawy:   Microsoft.ReportingServices.SharePoint.UI.WebParts (w Microsoft.ReportingServices.SharePoint.UI.WebParts.dll)
  Microsoft.ReportingServices.Interfaces (w Microsoft.ReportingServices.Interfaces.dll)

Składnia

'Deklaracja
<StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey := "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")> _
Sub GetUserInfo ( _
    <OutAttribute> ByRef userIdentity As IIdentity, _
    <OutAttribute> ByRef userId As IntPtr _
)
'Użycie
Dim instance As IAuthenticationExtension
Dim userIdentity As IIdentity
Dim userId As IntPtr

instance.GetUserInfo(userIdentity, userId)
[StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")]
void GetUserInfo(
    out IIdentity userIdentity,
    out IntPtr userId
)
[StrongNameIdentityPermissionAttribute(SecurityAction::LinkDemand, PublicKey = L"0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")]
void GetUserInfo(
    [OutAttribute] IIdentity^% userIdentity, 
    [OutAttribute] IntPtr% userId
)
[<StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")>]
abstract GetUserInfo : 
        userIdentity:IIdentity byref * 
        userId:IntPtr byref -> unit 
function GetUserInfo(
    userIdentity : IIdentity, 
    userId : IntPtr
)

Parametry

  • userIdentity
    Typ: System.Security.Principal.IIdentity%
    [Brak] Tożsamość bieżącego użytkownika.Wartość IIdentity mogą być wyświetlane w interfejs użytkownika i powinny być ludzi czytelny.
  • userId
    Typ: System.IntPtr%
    [Brak] Token konta użytkownika.Token ten jest używany głównie przez serwer raportów jako uchwyt do konta systemu Windows w celu wspierania zarządzania poświadczeniami uwierzytelniania systemu Windows.

Uwagi

serwer raportów Wywołania GetUserInfo metoda dla każdego żądania pobrać bieżącej tożsamości użytkownika.

Przykłady

Poniższy przykład kodu implementuje GetUserInfo metoda przywracając tożsamości głównych bieżącej żądania HTTP.

Public Sub GetUserInfo(ByRef userIdentity As IIdentity, ByRef userId As IntPtr)
   ' If the current user identity is not null,
   ' set the userIdentity parameter to that of the current user 
   If Not (HttpContext.Current Is Nothing) And Not (HttpContext.Current.User Is Nothing) Then
      userIdentity = HttpContext.Current.User.Identity
   Else
      userIdentity = Nothing
   End If 
   ' initialize a pointer to the current user id to zero
   userId = IntPtr.Zero
End Sub 'GetUserInfo
public void GetUserInfo(out IIdentity userIdentity, out IntPtr userId)
{
   // 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;
   }
   else
      userIdentity = null;

   // initialize a pointer to the current user id to zero
   userId = IntPtr.Zero;
}