LoggedOnUser.h
Go to the documentation of this file.
1 #pragma once
2 
3 namespace AppSecInc
4 {
5  namespace LSA
6  {
9  {
10  protected:
11  HANDLE m_hUser;
12  private:
14  void GetTokenInformation(TOKEN_INFORMATION_CLASS, std::vector<byte>&) const;
15  public:
16  LoggedOnUser();
17  virtual ~LoggedOnUser();
19  void Logon(const std::wstring& username, const std::wstring& domain, const std::wstring& password,
20  DWORD dwLogonType, DWORD dwLogonProvider = LOGON32_PROVIDER_DEFAULT);
22  void Logon(const std::wstring& username, const std::wstring& password,
23  DWORD dwLogonType, DWORD dwLogonProvider = LOGON32_PROVIDER_DEFAULT);
25  void Logout();
27  bool IsLoggedOn() const { return m_hUser != NULL; }
29  Sid GetSid() const;
31  std::vector<Sid> GetGroups() const;
33  std::vector<Privilege> GetPrivileges() const;
35  bool HasPrivilege(LUID luid) const;
36  };
37  }
38 }
39 
LoggedOnUser()
Definition: LoggedOnUser.cpp:6
A logged-on user.
Definition: LoggedOnUser.h:8
std::vector< Sid > GetGroups() const
returns the user group memberships (SIDs)
Definition: LoggedOnUser.cpp:120
bool HasPrivilege(LUID luid) const
return true if the user holds a specific privilege
Definition: LoggedOnUser.cpp:135
HANDLE m_hUser
Definition: LoggedOnUser.h:11
Sid GetSid() const
returns the user SID
Definition: LoggedOnUser.cpp:92
virtual ~LoggedOnUser()
Definition: LoggedOnUser.cpp:35
bool IsLoggedOn() const
returns true on logon
Definition: LoggedOnUser.h:27
void Logon(const std::wstring &username, const std::wstring &domain, const std::wstring &password, DWORD dwLogonType, DWORD dwLogonProvider=LOGON32_PROVIDER_DEFAULT)
logon a user
Definition: LoggedOnUser.cpp:12
Security identifier: a data structure of variable length that identifies user, group, and computer accounts.
Definition: Sid.h:8
std::vector< Privilege > GetPrivileges() const
returns a set of privileges that the logged on user has
Definition: LoggedOnUser.cpp:101
void Logout()
logout a user
Definition: LoggedOnUser.cpp:24


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