问题
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)
}
回答1:
The SID
of a user can change (e.g. if you merge two domains). That's why there's a SIDHistory attribute on your AD objects, too :-)
See this TechNet blurb on SID vs. GUID.
The one thing that will always remain the same is the objectGUID
from Active Directory - fixed for life.
来源:https://stackoverflow.com/questions/13144919/active-directory-user-data-storage