0
votes

When working with Claims based identity with AspNet, in my case just using the templates coming with Visual studio 2013.

Taking the EntityFramework implementation of Microsoft.AspNet.Identity and looking at the User Model class.

Is it the intention that one put profile info into claims or to extend the user model with additional properties?

An example would be, I want to add a country associated with each user and edits the registration flow such user can give this information. Should I put this on the user or add it as a claim for that user.

1
Add it to the User as a single user has multiple claims, but presumably only one Country in your example. You will need to use data migrations in VS to get it to work though as database first always seems to fail with ASP.Net IdentityGone Coding
The name/username/givenname is also something that a user only have one of, but still thats in claims.Poul K. Sørensen
You will find that the name/username/givenname can vary per website as it is only what they provided to that website. That is why it is in claims... because they claim that is their name/username/givenname :)Gone Coding

1 Answers

0
votes

To follow on from my comments, you want to put any user-specific settings (i.e. 1:1 relationship ) into the user table and not the claims table. That would apply to your profile settings

The claims table is per external claim. Although claims may contain duplicate values, they allow for the values (even name) to vary from site to site. It is after all only the value the user stated when they signed up to the external website.

There is also the facility to add additional separate tables, that relate to the user table, but probably not worth the extra effort for profile data.

*Note: there appear to be problems using database-first with asp.net identity, so you will likely need to make model-first changes and use database migration to update your database (which we wound up doing)