I'm trying to create my own [Authorize] Attribute so I can use my own authorize logic to have hierarchal roles.
If someone does [Authorize(Roles = "Admin")]
on a controller or action
How do I get the string "Admin" in my AuthorizeCore function?
I'm using this code:
public class Authorize : AuthorizeAttribute
{
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
//authorize role logic
if (true)
return true;
return false;
}
}
MVC4, .net 4.5, c#, VS 2012