I am spending time these days to analyze and understand some implementation details that drive the identity for ASP. And one particular implementation really caught my mind, I am not saying it’s right or wrong, but it’s something to be aware of:
The UserStore and the UserOnlyStore give you all the functionality you need for the UserManager to be used in your ASP project. This store implements all the required functionality for most of the identity requirements.
The interface IUserClaimStore exposes the following methods:
As you can see, this method does not work with derivates of the IdentityUserClaim model, and it’s a perfect approach since it leaves the choise to the developer to use a different class if he needs, and the implementation details will convert Claim to the Database model Claim. In the EF implementation this model is a derivative if the IdentityUserClaim
The IdentityUserClaim has a very simple implementation, same as ClaimLite or ClientClaim from IdentityServer with the difference that this has the UserId in the model.
What you can see from the above model is that Issuer is not defined in the database model, and without an issuer I don’t really see any reason why a user should have more values for any given type, providing that are do not use claims to define complex array objects with types as a dictionary key, right?
Having this in mind, there are 2 questions that for me are unclear at this point:
IdentityUserClaim is extensible, and should I decide to use the Issuer property then I can justify having multiple values per type provided by the multiple sources. (Facebook GivenName, Google GivenName, and so on). This check and how it’s implemented has no way of verifying that, and I think the responsability should be moved in the IdentityUserClaim model.
Original:My idea of it:
Why should the value be checked? We are replacing a claim with another claim, we are not replacing a pair claim-type-value with a new claim.Perhaps some of these questions will be clarified,I’ll keep you posted.
The Project In this article I am using IdentityServer4 which has been enriched with Identity to have access to UserManager and SignInManager. The key part about linking these 2 together was the use of aRead more
Unit tests are extremely important in making sure your application behaves normally. There is often the need to unit test a method which requires an authenticated context and lucky there is an easy way toRead more
To use the ASP Identity manager there are some builtin extension methods that add all the required dependencies. AddIdentity<TUser, TRole> – this method adds the UserManager, SignInManager and RoleManager AddIdentityCore<TUser> – this method adds onlyRead more
The Microsoft team provides a pretty good library (with minor issues which I will discuss in other posts) for managing users and authentication. AspIdentity is very configurable and it meets most demands for small andRead more
In my path to understand the magic behind the frameworks because without knowing we are just playing blank, I have tried to follow the trail of the sign in method that Identity uses when signingRead more
We use cookies to optimize our website and our service.
Functional
Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.