Managing users and roles
In the previous sections, we implemented the authentication and authorization features. Generally, the application should also provide a way to manage users and roles. ASP.NET Core Identity provides a set of APIs to manage users and roles. In this section, we will introduce how to use these APIs.
Previously, we learned that the IdentityDbContext
class is used to store the user and role information. So, we do not need to create a new database context class. Similarly, we can use UserManager
and RoleManager
to manage users and roles without having to write any code.
Here are some common operations for managing users by using the UserManager
class:
Method |
Description |
|
Creates a user with the given password. |
|
... |