INSSEventAuthorization::AuthorizeEvent

The INSSEventAuthorization::AuthorizeEvent method is called when a specified event is requested.

Syntax

HRESULT AuthorizeEvent (
NSS_EVENT *pEvents,
INSSUserContext *pUser,
INSSPresentationContext *pPresentation,
INSSEventAuthorizationCallback *pCallback,
DWORD dwRequestId
);

Parameters

[in] pEvents

Specifies the server event being authorized.

[in] pUser

Specifies a pointer to the user context. The user context is used to store information about the client. For more information about the user context and its properties, see Event Authorization and Notification Contexts in the guide.

 [in] pPresentation

Specifies a pointer to the presentation context property map interface. The presentation context is used to store information about the presentation. For more information about the presentation context and its properties, see Event Authorization and Notification Contexts in the guide.

[in] pCallback

Specifies a pointer to the INSSEventAuthorizationCallback::OnEventAuthorized callback method authorizing the server to perform the requested event. The callback interface is implemented by the server.

[in] dwRequestId

Specifies the request ID. This parameter is passed back to the INSSEventAuthorizationCallback::OnEventAuthorized method to uniquely identify the event being requested.

Return Values

This method should return S_OK upon successful completion. Authorization errors should be passed to the callback interface.

Remarks

A request from a client to perform any of the events specified by the INSSEventAuthorization::GetAuthorizedEvents method triggers a call to this method.

If the authorization process is expected to be lengthy, the call into this method can use another thread to check authorization and return immediately so the server won’t be tied up.

The following code illustrates a skeleton implementation of the INSSEventAuthorization::AuthorizeEvent method;

HRESULT
CEventHandler::AuthorizeEvent( 
      NSS_EVENT __RPC_FAR *pEvent,
      INSSUserContext __RPC_FAR *pUser,
      INSSPresentationContext __RPC_FAR *pPresentation,
      INSSCommandContext __RPC_FAR *pCommand,
      INSSEventAuthorizationCallback __RPC_FAR *pCallback,
      DWORD dwRequestId ) 
{
  HRESULT hr;
  
  if ( ( NULL == pEvent )
    || ( NULL == pCallback ) )
  {
    return( E_INVALIDARG );
  }
//
// The authorization routine goes here. The results of the authorization 
// is sent to the call back in the hr parameter
//
  pCallback->OnEventAuthorized( hr, dwRequestId );
  return( S_OK );
};

See Also

INSSEventAuthorization::GetAuthorizedEvents; INSSEventAuthorizationCallback::OnEventAuthorized

© 1996-1998 Microsoft Corporation. All rights reserved.