Listing 1 The AccessToken class declaration
namespace SynSoft { namespace Security { /// Represents a security AccessToken public __gc class AccessToken : public IDisposable { private: typedef void *HANDLE; private: /// Create an instance managing the given security handle AccessToken(HANDLE hToken); /// Finaliser ~AccessToken(); // IDisposable public: /// Provides facility for void Close(); void Dispose(); // Creation public: /// Open the access token for the current process static AccessToken *OpenProcessToken(); /// Open the access token for the current thread static AccessToken *OpenThreadToken(); // Attributes public: /// The token's user account __property SID *get_User(); /// The groups accounts associated with the access token __property GroupList *get_Groups(); /// Privileges __property PrivilegeList *get_Privileges(); /// The security identifier of the owner __property SID *get_Owner(); /// The primary groups of any objects created with the access token __property SID *get_PrimaryGroup(); /// Default DACL __property ACL *get_DefaultDACL(); /// Source __property TokenSource *get_Source(); /// Type __property TokenType get_Type(); /// Impersonation Level __property TokenImpersonationLevel get_ImpersonationLevel(); /// Statistics __property TokenStatistics *get_Statistics(); /// Restricted SIDs __property GroupList *get_RestrictedSIDs(); /// Session Id __property Int32 get_SessionId(); /// Sandbox Inert __property bool get_SandboxInert(); // Standard members public: // Returns a string representation of the AccessToken String *ToString(); // Implementation private: GroupList *_get_groups(TOKEN_INFORMATION_CLASS tic); // Members private: HANDLE m_hToken; SID *m_user; GroupList *m_groups; PrivilegeList *m_privileges; SID *m_owner; SID *m_primaryGroup; ACL *m_defaultDACL; TokenSource *m_source; TokenStatistics *m_statistics; GroupList *m_restrictedSIDs; }; } }