ASP.NET MVC 5 6 Framework Identity 2 Role User Authentication Managment Configuration in C#

preview_player
Показать описание
PLEASE READ

This Video will show you how to add functionality to a Microsoft MVC ASP.NET application to create and instantiate the RoleManager with Identity 2, so that you can
List Roles, Create a Role and Assign a role to a user through ApplicationUserManager.
You will also assign the authorization of a role to an action within a controller.

Identity 2 provides the necessary functionality to create, manage users, roles, authentication of two factors, external providers such as Facebook, Twitter, Google, sending SMS and EMAIL for verification, although we must provide our own provider

For the management of the user we have UserManager
For role management we have RoleManager

For persistence we can use the Entity Framework context

This particular case treats Individual User Accounts, but works equally for Active Directory, Windows accounts, and other persistence providers like Oracle

This example was made with Visual Studio 2017 and MVC 6, however you can replicate it using other versions. For example with MVC 5 and Visual Studio 2015.
This example was written in C #, but the translation to VisualBasic should not be a mystery

The idea of ​​the video is to show the basic functionality but it remains as work to make the optimizations and validations for a robust software and to control the flow of authentication and authorization.

You could for example use it as the basis for creating a role-based authentication control system (RBAC)

It is possible to use the same Identity system but in a Windows Foms application, using all the infrastructure already proposed by Identity

The pending work would be to create a Custom AuthorizeAttribute that allows you to have more control over the flow of authorization and authentication
Using Reflection you could get all the public actions inside the controllers and assign them to a specific role.

The topics that could bring you to this video can be
OWIN Authentication
Katana
IdentityRole
RoleManager
ApplicationRoleManager
ApplicationDbContext
Individual User Accounts
ApplicationUserManager
ApplicationSignInManager
App.CreatePerOwinContext ApplicationUserManager (ApplicationUserManager.Create)
App.CreatePerOwinContext ApplicationRoleManager (ApplicationRoleManager.Create)
[Authorize (Roles = "")]
RoleManager.RoleExists (newRole.RoleName)
RoleManager.CreateAsync (_newRole)
RoleManager.Create (_newRole)
RoleManager.RoleExists (_roleName)
UserManager.AddToRole (_userId, roleName)
Рекомендации по теме
Комментарии
Автор

Te felicito porque ha sido el único video que aplico lo explicado y sale a la perfección, siempre en otros videos se les olvidan cosas que hay que añadir y uno se rompe el casco buscando que hacer. Bien agradecido por este gran aporte

wylosuavez
Автор

Felicitaciones!! Muchas gracias por el video. Me ha ayudado.

dpwsreceptivo
Автор

Muchas gracias me ayudo bastante like!!

TheTeamojacky
Автор

Thank you so much
I learned a lot here
Thank you from the depths

honeesh
Автор

thank you so much! but i have questions, where are the users stored? how do i manage them(change their emails, etc.)

gengcass
Автор

Hola. ThankYou for Uploading the video it helped me a lot, but there was a small problem that i faced.
It's on AddRoleToUser view pages on @foreach (var item in errores) whenver i hit the "Manage/AddRoleToUser" action name
it throws error "Object reference not set to an instance of an object." @foreach (var item in errores)
I have done everything same as in the video. Please help me !

aviznepz
Автор

Sería de provecho que pusieras audio al video

diegoguerrero
welcome to shbcf.ru