Language

IAuthenticationExtension.GetUserInfo(IIdentity, IntPtr) メソッド

定義

現在のユーザーIDを返します。

public:
 void GetUserInfo([Runtime::InteropServices::Out] System::Security::Principal::IIdentity ^ % userIdentity, [Runtime::InteropServices::Out] IntPtr % userId);
public void GetUserInfo(out System.Security.Principal.IIdentity userIdentity, out IntPtr userId);
abstract member GetUserInfo : IIdentity * nativeint -> unit
Public Sub GetUserInfo (ByRef userIdentity As IIdentity, ByRef userId As IntPtr)

パラメーター

userIdentity
IIdentity

[アウト]現在のユーザーの身分。 II同一性の価値はユーザーインターフェースに現れ、人間が読みやすいものであるべきです。

userId
IntPtr

nativeint

[アウト]ユーザーアカウントトークンです。 このトークンは主にレポートサーバーがWindowsアカウントのハンドルとして使用し、Windows認証のための認証管理をサポートします。

例

以下の例コードは、現在のHTTPリクエストの主識別子を返すことで GetUserInfo メソッドを実装しています。

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

注釈

レポートサーバーは各リクエストごとに GetUserInfo メソッドを呼び出し、現在のユーザーIDを取得します。

適用対象