Called when authorization for 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 overview.
[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 theoverview.
[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 identifier (ID). This parameter is passed back to the INSSEventAuthorizationCallback::OnEventAuthorized method to uniquely identify the requested event.
Return Values
This method must return S_OK upon successful completion. Authorization errors must 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 the INSSEventAuthorization::AuthorizeEvent 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 is not kept waiting.
The following code illustrates a skeletal implementation of the INSSEventAuthorization::AuthorizeEvent method:
HRESULT
CEventNotification::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
// are sent to the callback in the hr parameter.
//
pCallback->OnEventAuthorized( hr, dwRequestId );
return( S_OK );
};
See Also
INSSEventAuthorization::GetAuthorizedEvents; INSSEventAuthorizationCallback::OnEventAuthorized
[Previous][Next]