I'm writing a .NET MVC 5 app which is on an intranet, uses Windows Authentication and needs to query Active Directory to see what groups are available and then check if a user is in that role.
The source of group and user names will be active directory. I then need to check identity and membership using .NET Identity. I'm not sure what fields map to what.
Fields of interest in AD seem to be:
- SamAccountName: I think this is the username that I get from User.Identity, but the docs say that this property is: The logon name used to support clients and servers running earlier versions of the operating system, such as Windows NT 4.0, Windows 95, Windows 98, and LAN Manager.
- CN: A displayable version of the user's name
- objectGUID: An identifier for a user or group that won't change. Important as users will change their username if their surname changes.
So, I think SamAccountName == User.Identity.Name, but the docs say that SamAccountName is for earlier operating systems. Does this effectively mean this is deprecated and I should be using something else?
Also, are my assertions about CN and objectGUID correct?