There are two important security considerations regarding impersonation and delegation:
What should the server be allowed to do when acting for the client?
What identity is presented by the server when it calls other servers for a client?
In Windows, the Component Object Model (COM) provides the functionality that is explained here. The client can set an impersonation level that determines the extent to which the server can act as the client. If the client grants enough authority to the server, the server can impersonate (pretend to be) the client. When the server impersonates the client, it is given access to only those objects or resources that the client has permission to use. The server, acting as a client, can also enable cloaking in order to mask its own identity and project the client identity in calls to other COM components.
The following figure illustrates impersonation without and with cloaking. A and B represent two processes running on machine 1, and C represents a process that is running on machine 2. Process A calls B, and B calls C. Client A sets the impersonation level. B sets the cloaking capability. If A sets an impersonation level that permits impersonation, B can impersonate A when calling C on A's behalf. The identity that is presented to process C is either A's identity or B's identity, depending on whether cloaking was enabled by B. If cloaking is enabled, the identity that is presented to process C is A. If cloaking is not enabled, B's identity is presented to C.
Figure 8: Impersonation without and with cloaking