NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Replacing a Principal Object

For applications that provide managed code with authentication services, it is necessary for those applications to be able to replace the Principal object for a given thread. It is important that the ability to replace Principal objects be protected by the security system because the Principal object carries information that affects what the principal is allowed to do. Therefore, applications that require the ability to replace Principal objects must request and be granted the System.Security.Permissions.SecurityPermission for principal object control. (Note that this permission is not required for performing role-based security checks or creating Principal objects.)

The current Principal object can be replaced by successfully performing the following tasks:

Automatic memory management (garbage collection) can take place whenever all references to an object have been released; therefore, if an application replaces an active Principal object, it needs to release any references to the old Principal object so that the memory associated with that object can be released.