I have a BaseController that all Controllers inherit from. The CaseController has the [Authorize] annotation, so that all controllers require authorization.
But I've just realized that one single controller action must not require authorization. How can I turn off [Authorize] for just that one controller action?
using System.Web.Mvc;
using Unleashed.Service.Interfaces;
namespace Controllers
{
[Authorize]
[RequireHttps]
public class BaseController : Controller
{
}
}
And the controller action is called via a POST from another site. They authorize by passing a token. They will not be authorized via forms authentication.
[Authorize=false] // doesnt compile
[Authorize(false)] // doesnt compile
public ActionResult DoSomething(string token, string data)
{
}