1

I need to be able to access CRUD operations on the users in a system using ASP.NET Web API 2 using ASP.NET Identity. Via the API, I would like to list all users in the system, and allow the API to modify, delete and add new users to the system. Can someone provide me with some direction on how this would be accomplished?

Thanks!

2
  • 3
    have you tried anything? Any code? maybe a blog or a codeproject post? Commented Sep 11, 2014 at 12:53
  • 1
    User management through WebApi is not much different from MVC. Identity framework is not coupled with MVC framework, so take sample from MVC and convert it to WebApi. Commented Sep 11, 2014 at 13:03

2 Answers 2

1

You can expose all the functions of the UserStore via your webapi and that would get you a long way toward what you are describing. For the functions it does not provide, you are responsible for instantiating the IdentityDbContext to the UserStore so you can using for whatever you like including listing all users, organizing by roles and so on that an admin interface would require.

I actually implemented a UserStore that called a webapi wrapped UserStore via http to preserve a clients layered architecture. Not difficult at all to do.

Here is a link that discusses more about using IdentityDbContext directly. Why is Asp.Net Identity IdentityDbContext a Black-Box?

Sign up to request clarification or add additional context in comments.

Comments

1

You can expose or create new end points which are responsible for the CRUD operations against the users, you can check this post as it shows how to register (add) new users so you will get the idea how to complete the rest operations. http://bitoftech.net/2014/06/01/token-based-authentication-asp-net-web-api-2-owin-asp-net-identity/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.