Storing a Windows SID in a search database

I have an ASP.NET MVC application where I need to allow clients to configure MembershipProviders based on their environment, but still be able to map this MemberhipUser to a specific user model in our database.

Membership.GetUser()will give me access to a registered user Membership.ProviderUserKey. I can use this to communicate with a user post. Our custom SQL provider will simply return User.Id, but AD is a completely different story. In this case ProviderUserKeyis IdentityReference.

These searches will happen very often, as you might imagine (although caching can help reduce search at the database level).

I cannot decide which route is better: Store the SID as a varbinary or varchar column. This column will not be a primary key and will not have a clustered index. Knowing that I can index strings very well, and reading the SID in string format is definitely better than binary. Anyone who wants to share how they solved this situation?


Update

I don’t know how I skipped this SO question when I searched before I sent a message, but it seems clear that ActiveDirectoryMembershipProviderthey ActiveDirectoryMembershipUserare not completely cut out for this task, as they exist today.

The answer in this SO question related the following article , which stated the following:

SID , , , .

, , SID Object-SID.

Object-GUID, , . Object-GUID User, Object-SID. - , , , .

, ActiveDirectoryMembershipUser Object-GUID. , SID GUID , ActiveDirectoryMembershipUser , MembershipProvider, , , . , , , , , , ActiveDirectoryMembershipProvider.

+3
3

Microsoft SID varbinary (85) sys.server_principals

, ...

+5

- , .

SID AD . 2 - (< 1000) . , Administrator, Guest .., RID.

.., GUID - .

.

, , , . John Smith.

ADSI. COM-, ASP. MSDN . ADSearch (, DN) GUID.

0

, , . SID GUID? , , ActiveDirectory.

" ". , , .

, ActiveDirectory. , , .

If they are configured to use user login in db, if successful, set the same session variable to indicate that they have successfully logged in.

No fancy GUID or SID ... simple.

-3
source

Source: https://habr.com/ru/post/1721147/


All Articles