Previous | Next |
Called when authorization of 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 stores information about the client. For more information about the user context and its properties, see Event Notification and Authorization Contexts.
[in] pPresentation
Specifies a pointer to the presentation context property map interface. The presentation context stores information about the presentation. For more information about the presentation context and its properties, see Event Notification and Authorization Contexts.
[in] pCallback
Specifies a pointer to the INSSEventAuthorizationCallback::OnEventAuthorized callback method that authorizes 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 event being requested.
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 this method.
If the authorization process is expected to be lengthy, the call into this method can use another thread to check authorization. In this way, it returns immediately and does not keep the server 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 |