What is the best method using MVC4 to store user data for users authenticated with Active Directory? Should I use SID as the user id? For example:
CREATE TABLE MyStuff AS
{
ID INT IDENTITY (1,1) NOT NULL UNIQUE,
AccountDomainSid VARCHAR(50),
Stuff VARCHAR(100)
}
The
SIDof a user can change (e.g. if you merge two domains). That’s why there’s aSIDHistoryattribute on your AD objects, too 🙂See this TechNet blurb on SID vs. GUID.
The one thing that will always remain the same is the
objectGUIDfrom Active Directory – fixed for life.