src/Common/Lsa/LoggedOnUser.h

Go to the documentation of this file.
00001 #pragma once
00002 
00003 namespace AppSecInc 
00004 {
00005     namespace LSA
00006     {
00008         class LoggedOnUser
00009         {
00010         protected:
00011             HANDLE m_hUser;
00012                 private:
00014                         void GetTokenInformation(TOKEN_INFORMATION_CLASS, std::vector<byte>&) const;
00015         public:
00016             LoggedOnUser();
00017             virtual ~LoggedOnUser();
00019             void Logon(const std::wstring& username, const std::wstring& domain, const std::wstring& password,
00020                 DWORD dwLogonType, DWORD dwLogonProvider = LOGON32_PROVIDER_DEFAULT);
00022             void Logon(const std::wstring& username, const std::wstring& password,
00023                 DWORD dwLogonType, DWORD dwLogonProvider = LOGON32_PROVIDER_DEFAULT);
00025             void Logout();
00027             bool IsLoggedOn() const { return m_hUser != NULL; }
00029                         Sid GetSid() const;
00031                         std::vector<Sid> GetGroups() const;
00033                         std::vector<Privilege> GetPrivileges() const;
00035                         bool HasPrivilege(LUID luid) const;
00036         };
00037     }
00038 }
00039 


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com