The procedure whereby a server application checks that a connected client actually has access rights to a requested object is called client impersonation. In this process, when the client application makes an object request of the server application, it passes along its access token. The server application uses this access token to log on as the client (impersonate the client), attempting to access the desired object in the same manner that the client is asking for it.
NOTE
It is true that the server application could instead look up the security information for the client, and then get the security information for the asked-for object, and see whether the client has the desired permissions that way. However, impersonation is the simpler and more foolproof method of doing this.
Here are the steps a server application might typically make to use client impersonation in implementing server-side security:
For private objects, the server and client must establish some consistent means of referring to desired objects. This could be done by using either a handle or token type, which the server assigns and keeps track of. Alternatively, it may be a string or whatever other protocol the server and client applications implement to refer to server-application managed objects.
For private objects whose security is being handled by the server application (as opposed to some other server application running on the same or another machine), it is still important to use ImpersonateLoggedOnUser, since in the course of handling the client’s request, the server may need to open or access objects for which Windows NT does have some level of built-in security assigned. By using impersonation through the entire request-handling section, the server application ensures that it won’t inadvertently do something on the client’s behalf that is explicitly restricted from that user.
Individual server threads (or processes) can each have a different impersonation access token assigned. This is necessary for permitting simultaneous services to multiple clients.