Windows Media Services SDK banner art
PreviousNext

INSSUserAuthentication::GetUserId

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 must return S_OK upon successful completion, or an HRESULT error code.

Remarks

The user ID is the name of the user account that has been validated. The server uses this value when generating logs and similar reports.

This method must 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

PreviousNext


© 1996-1999 Microsoft Corporation. All rights reserved.