I am trying to build my custom authorization middle ware
in ASP.Net Core
. Which checks if the called action
(method in controller class) is tagged by [Authorize]
attribute. I still do not have good ideas how can I implement that.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.Use((context, next) =>
{
// if (THE CALLED ACTION HAS [Authorize] attribute)
// DO SOMETHING...
return next();
});
app.UseMvcWithDefaultRoute();
}
Could some one give me any hint to implement the commented condition?