In a windows WPF desktop app I am using System.Environment.UserName
in this way:
var q = from l in db.Logins where
l.WinLogin.Trim().Equals(System.Environment.UserName, StringComparison.InvariantCultureIgnoreCase)
&& l.WinDomain.Trim().Equals(System.Environment.UserDomainName, StringComparison.InvariantCultureIgnoreCase)
select l.LoginID;
var login = q.FirstOrDefault();
if (login == null)
/*Access rejected*/
else
/*Access granted*/
I am wondering if the content of the System.Environment.UserName
& System.Environment.UserDomainName
can be easiliy faked (set to someone's else account) within windows domain or not by a non administrator user.
I hope that this authentication is OK for a normal windows app that does not require top security, just want to make sure I did not overlook something obvious.
For instance if I create home workgroup with the same name as the windows domain has and then create a user within that workgroup and then connect using VPN to that windows domain and install the app on the home workgroup computer, will I fake theese variables and get the access or not?