I am using MVC 5 for ASP.NET.
I am trying to create a custom authorize attribute. Users are authenticated to my application, using OpenId and if a session variable exists. I have added the [OpenIdAuthorize] to my controllers. When I view them after sign in, I get bounced back to /openid/index in my application. The session variable exists. I added breakpoints, but they are never reached.
public class OpenIdAuthorizeAttribute : System.Web.Mvc.AuthorizeAttribute
{
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
if (httpContext.Session["FriendlyEmail"] == null)
return false;
else
return true;
}
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
{
if(filterContext.HttpContext.Session["FriendlyEmail"] == null)
filterContext.Result = new RedirectResult("/openid/index");
}
}
Here is my controller:
[OpenIdAuthorize]
public class RuleSetController : Controller
AuthorizeCorefunction?AuthorizeCorefunction getting hit?AuthorizeAttributestill active? It might have been added as a global filter inFilterConfig?