UserManager<T> is the ASP.NET Core Identity service for managing application users. In an account API, inject UserManager<ApiUser> into AccountController and use it to create users, find them by name, and verify passwords. section 9.2.6
Use UserManager<ApiUser> for these account and authorization tasks:
- Check role membership with IsInRoleAsync and add users to roles with AddToRoleAsync during repeatable authentication-data seeding. section 9.4.2
Account registration
Validate RegisterDTO, copy its username and email into a new ApiUser, and call await _userManager.CreateAsync(newUser, input.Password). Check result.Succeeded before logging the creation and returning HTTP 201. Invalid email data produces HTTP 400, while a password that fails configured requirements produces an error response.


