ASP.NET MVC 5: Custom AuthorizeAttribute for custom authentication

In a previous post I wrote about how you can should protect your web app from human errors made by developers, by enforcing authentication by default.

Since adding the AuthorizeAttribute to every action involves global filters, we can use that to add our own custom authentication, by inheriting AuthorizeAttributeand overriding the AuthorizeCore and HandleUnauthorizeRequest methods.

Read More »ASP.NET MVC 5: Custom AuthorizeAttribute for custom authentication

ASP.NET MVC 5: “Authorization” by default for your web app

Securing your MVC app is a tricky business! Although security is a huge topic, one of the problems that you might encounter is that unauthenticated users are allowed by default to execute every action in your web app. That behaviour is potentially unsafe because you have to remember to decorate your actions with the authorize attribute, and humans are prone to errors!

This is why, in my opinion, authentication should be enforced by default, or differently [Authorize] attribute should be added behind the scenes to every action.

Read More »ASP.NET MVC 5: “Authorization” by default for your web app