I'm having a bit of an issue understanding how Authorization works in MVC when we extend the Authorize attribute.
So in the code we have extended the AuthorizeAttribute like this:
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
public class AuthExtendAttribute : AuthorizeAttribute
We then add the extension to the list of global filters like this:
filters.Add(new AuthExtendAttribute());
Then the action methods are decorated with the Authorize attribute like this:
[Authorize]
public bool DoStuff()
My question is, will this new extension replace the default behavior of the [Authorize] attribute or will the framework still use the default behavior and then call the overridden methods in AuthExtendAttribute?
Also, why would I need to add the extension to the global filter list if I could simply decorate my action methods with [AuthExtend]?
Is it also true that with newer MVC applications we shouldn't be extending the Authorize attribute but rather we should be using the new Policy based authorization?