> C#/.Net Samples
> .Net Authentication
> Setting up ASP.NET Identity 2 with External Logins Facebok Google Microsoft and Twitter
We’ll place all the common functionality related to user administration in UserAdmin Controller. We’ll build the functionality as we progress through this tutorial by implementing custom fields and securing the UserAdmin controller with roles.
You need to pay attention to the way instance has been created to the ApplicationUserManager class
AddErrors helper method will be used by all the actions:
I wanted to keep my identity models separate from the rest of the model, during learning phase. So, I have created a new folder called IdentityModels and will be placing all the models here.
Obtaining the instance of the ApplicationUserManager class. This instance will be used by all the actions.
> .Net Authentication
> Setting up ASP.NET Identity 2 with External Logins Facebok Google Microsoft and Twitter
Step # 11
For other steps follow:
Setting up ASP.NET Identity 2 with External Logins Facebook Google Microsoft and TwitterWe’ll place all the common functionality related to user administration in UserAdmin Controller. We’ll build the functionality as we progress through this tutorial by implementing custom fields and securing the UserAdmin controller with roles.
You need to pay attention to the way instance has been created to the ApplicationUserManager class
AddErrors helper method will be used by all the actions:
private void AddErrors(IdentityResult result)
{
foreach (var error in result.Errors)
{
ModelState.AddModelError("", error);
}
}I wanted to keep my identity models separate from the rest of the model, during learning phase. So, I have created a new folder called IdentityModels and will be placing all the models here.
Obtaining the instance of the ApplicationUserManager class. This instance will be used by all the actions.
public UsersAdminController()
{
}
public UsersAdminController(ApplicationUserManager applicationUserManager)
{
UserManager = applicationUserManager;
}
private ApplicationUserManager _applicationUserManager;
public ApplicationUserManager UserManager
{
get
{
return _applicationUserManager ?? HttpContext.GetOwinContext().GetUserManager<ApplicationUserManager>();
}
private set
{
_applicationUserManager = value;
}
}
| Previous: Add OWIN App Setting | Next: Create User |