Skip to content

Commit

Permalink
pGina core add property PreferLocalAuthentication
Browse files Browse the repository at this point in the history
- #70
  If a system is a domain member pgina will authenticate users by def. against the domain
  To invert this behavior an admin can set PreferLocalAuthentication (if .\username is not convenient).
  pGina will than authenicate against the local machine (a pGina authentication is always local)
  To authenticate against the domain a user than needs to pass the domainname, like
  domain\user or [email protected]
  • Loading branch information
MutonUfoAI committed Aug 25, 2017
1 parent 9ec9009 commit ee3858f
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 33 deletions.
2 changes: 1 addition & 1 deletion pGina/src/Abstractions/WindowsApi/pInvokes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,7 @@ public static string CreateUserProfileDir(IntPtr hToken, string username)
}
else
{
LibraryLogging.Error("CreateProfile error:{0} {1}", hResult, LastError());
LibraryLogging.Error("CreateProfile error:{0} {1} {2}", hResult, LastError(), path.ToString());
}

return "";
Expand Down
76 changes: 44 additions & 32 deletions pGina/src/Configuration/ConfigurationUI.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pGina/src/Configuration/ConfigurationUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ private void LoadGeneralSettings()

// Display last username in logon screen
chk_lastusername.Checked = Settings.Get.LastUsernameEnable;
chk_preferlocalauthentication.Checked = Settings.Get.PreferLocalAuthentication;

//ntp server
//this.ntpservers = Settings.Get.GetGetSetting("ntpservers");
Expand Down Expand Up @@ -946,6 +947,7 @@ private bool SaveSettings()

// Display last username in logon screen
Settings.Get.LastUsernameEnable = chk_lastusername.Checked;
Settings.Get.PreferLocalAuthentication = chk_preferlocalauthentication.Checked;

if (Abstractions.Windows.OsInfo.IsVistaOrLater())
this.SaveCpSettings();
Expand Down
1 change: 1 addition & 0 deletions pGina/src/Core/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public static void Init()
s_settings.SetDefault("ntpservers", new string[] { "" });
s_settings.SetDefault("LastUsername", "");
s_settings.SetDefault("LastUsernameEnable", false);
s_settings.SetDefault("PreferLocalAuthentication", false);

s_settings.SetDefault("CredentialProviderFilters", new string[] { });

Expand Down
17 changes: 17 additions & 0 deletions pGina/src/CredentialProvider/Credential.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,23 @@ namespace pGina
std::wstring title;
pGina::Memory::ObjectCleanupPool cleanup;

if (pGina::Registry::GetBool(L"PreferLocalAuthentication", false))
{
std::wstring dom = username;
size_t pos = dom.find(L"\\");
if (pos == std::wstring::npos)
{
pos = dom.find(L"@");
if (pos == std::wstring::npos)
{
pDEBUG(L"Credential::Connect: no \"\\\" or \"@\" found in username but PreferLocalAuthentication defined: change username to: \".\\%s\"", dom.c_str());
dom = L".\\";
dom.append(username);
username = _wcsdup(dom.c_str());
}
}
}

pGina::Protocol::LoginRequestMessage::LoginReason reason = pGina::Protocol::LoginRequestMessage::Login;
switch(m_usageScenario)
{
Expand Down

0 comments on commit ee3858f

Please sign in to comment.