This project has moved and is read-only. For the latest updates, please go here.


Extension methods for the System.Security.Principal.WindowsIdentity class. These extension methods are in the Security.Principal namespace, so in order to use them both the Security.Principal and System.Security.Principal namespaces must be included in your code.


System.Collections.Generic.IEnumerable<Security.Principal.GroupSecurityIdentifierInformation> GetAllGroups()

Get the group information for all of the groups that associated with the System.Security.Principal.WindowsIdentity . This is different from the standard System.Security.Principal.WindowsIdentity.Groups property in that none of the returned groups are filtered out. Before using any of the groups, it is important to ensure that they are enabled and not for deny-only by checking their attributes.

Return Value:
A collection of Security.Principal.GroupSecurityIdentifierInformation objects containing the group SIDs which are attacked to the WindowsIdentity's token, as well as the associated attributes.

Security.Principal.SafeTokenHandle GetSafeTokenHandle()

Get a SafeHandle for the token that the WindowsIdentity represents.

Return Value:
A Security.Principal.SafeTokenHandle for the token of the WindowsIdentity. This token handle can be used beyond the lifetime of the originating WindowsIdentity object and must be disposed of seperately.

bool IsAdministrator()

Determine if the a WindowsIdentity is in the Administrator role

Last edited Jun 3, 2009 at 9:31 PM by shawnfa, version 2


No comments yet.