IAuthenticationExtension.GetUserInfo(IIdentity, IntPtr) Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Retorna a identidade do usuário atual.
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)
Parâmetros
- userIdentity
- IIdentity
[fora] A identidade do usuário atual. O valor de IIdentity pode aparecer em uma interface de usuário e deve ser legível para humanos.
- userId
-
IntPtr
nativeint
[fora] Um token de conta de usuário. Esse token é usado principalmente pelo servidor de relatórios como um handle para uma conta Windows em suporte ao gerenciamento de credenciais para a Autenticação Windows.
Exemplos
O seguinte código de exemplo implementa o GetUserInfo método retornando a identidade principal da requisição HTTP atual.
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;
}
Comentários
O servidor de relatórios chama o GetUserInfo método para cada solicitação para recuperar a identidade atual do usuário.