INSSUserAuthentication::GetUserId

The INSSUserAuthentication::GetUserId method is called after authentication to retrieve the user ID.

Syntax

HRESULT GetUserId (
BSTR  **pbstrUserId
);

Parameters

[out] pbstrUserId

Specifies the address of a pointer to the authenticated user ID.

Return Values

This method should return S_OK upon successful completion, or an HRESULT error value.

Remarks

This method should only be called after authentication is complete, and only if the result is NS_AUTH_SUCCESS. The results of authentication can be determined by calling the INSSUserAuthentication::GetAuthenticationResult method.

Use the automation allocation function SysAllocString to allocate the user ID string.

The following sample code demonstrates a skeletal implementation of this method:

HRESULT CUserAuthentication::GetUserId( BSTR *pbstrUserId )
{
  //
  // Get the user id.
  //
  *pbstrUserId = SysAllocString (A2W (“User Name”) );
  if ( NULL == ( *pbstrUserId ) )
  {
    return ( E_OUTOFMEMORY );
  }
  return( S_OK );
}

See Also

INSSUserAuthentication::GetAuthenticationResult

© 1996-1998 Microsoft Corporation. All rights reserved.