我在 mvc 中实现了 openAuth 表单身份验证,与此页面http://www.strathweb.com/2012/08/adding-openid-authentication-to-your-asp-net-mvc-4-application/几乎相同
但是,当我不对我的动作使用属性时,我无法将其System.Web.Security.FormsIdentity
转换为。OpenIdIdentity
[OpenIdAuthorize]
[OpenIdAuthorize]
public ActionResult Index()
{
return View();
}
如果我添加[OpenIdAuthorize]
属性然后转换身份,它工作正常。我有一个操作应该适用于匿名用户和登录用户。但是,如果用户已登录,我想获取OpenIdIdentity
并使用它。
问题是,AuthorizeCore
如果我不将属性付诸行动,则不会调用 override 。