I'm confused, is the [Authorize] attribute an action filter or an Authorization filter?
The [Authorize] attribute is an authorization filter that can be seen by looking at its source code. If you look closely, it implements the IAuthorizationFilter interface and according to the documentation that classifies it as an authorization filter.
namespace System.Web.Mvc { // // Summary: // Specifies that access to a controller or action method is restricted to users // who meet the authorization requirement. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)] public class AuthorizeAttribute : FilterAttribute, IAuthorizationFilter .........
When is it running?
According to the documentation:
Filters are performed in the order indicated above. For example, authorization filters are always executed before action filters and exception filters are always executed after every other type of filter.
See the current documentation for filtering in MVC: https://msdn.microsoft.com/en-us/library/gg416513(VS.98).aspx
It clearly states that the [Authorize] attribute is an authorization filter:
The AuthorizeAttribute class and the RequireHttpsAttribute class are examples of authorization filters. Authorization filters run before any other filter.
Haaukurhaf
source share