I am working with Visual Studio 2019 (.net 4.7). My Visual project is based on MVC without webform and without Microsoft Identity.
I try to implement the mechanism of authentification and authorization because I want to use the atributes like [Authorize(Roles = "admins")]
on my Controller/actions.
I dont want to use Microsoft Identity, EF and OWIN.
I started to implement form authentification, and I can get in all my code the current UserName with User.Identity.Name
which has the same value as FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe)
used in the login process.
I can store the roles in the field UserData inside the FormsAuthentication Ticket.
Now, I want to implement the roles in order to activate the Authorize attributes and to use the function User.IsInRole("***")
all over in my code ;
Can someone help me ?