Domanda

I have created a webapi 2 service that I need to secure. I am trying to use the Individual Accounts in VS2013 but I after much research I cannot figure out how to:

a. Customize the User model with my own properties (no such class exists in template)

b. Get access to User and Role contexts

I tried using the nuget's EFMembershipCodeFirst package but I noticed its deprecated, this package provided access to the required classes (User/Role).

There are plenty of examples for Mvc but I'm using Angularjs as the front end.

Does anyone know how I can customize the User model that vs2013 Individual Accounts template creates? Maybe I'm missing something obvious? I'm a bit of newbie when it comes to securing webAPIs. Thanks

Edit: UserManage.Create() only takes a password and a username, I need override it to also accept myUniqueId. Any thoughts?

enter image description here

Updated title for clarity + added image.

È stato utile?

Soluzione 2

As per @Horizon_Net's suggestion, I created a custom class that derived from IdentityUser, but used the following as guidance:

Here

Altri suggerimenti

The classes you should concentrate on are the IdentityUser, UserManager and RoleManager classes.

This example shows you how you can use them.

Because your using AngularJS an option would be to create an ASP.NET Web API backend.

The official documentation is a good starting point to become familiar with ASP.NET Identity.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top