I'm using the built-in authentication/authorization system where the ApplicationUser
needs to log in and once authenticated, he is signed in with the SignInManager
.
I also have a different user, CustomUser
which extends ApplicationUser
. The CustomUser
is authenticated via external service. Once he is authenticated, I check if he exists, if not I create him and give him the CustomRole
.
How can I keep that CustomUser
authorized? I would like to be able to place the [Authorize(Roles="CustomRole")]
attribute above the actions where he should be allowed. Is that possible? What would I need to do to make that work? Or is there a better way?
EDIT
Here's the implementation of CustomUser. It is located under Application.Models
public class CustomUser : ApplicationUser
{
public int Gender
{
get;
set;
}
public string FCode
{
get;
set;
}
public bool Subscribed
{
get;
set;
}
}
This is a simplified version of CustomUser
.