MVC 5 OWIN login with claims and AntiforgeryToken. Do I miss a ClaimsIdentity provider?

后端 未结 6 1833
别那么骄傲
别那么骄傲 2021-02-01 23:43

I\'m trying to learn Claims for MVC 5 OWIN login. I try\'ed to keep it as simple as possible. I started with the MVC template and inserted my claims code (see below). I get an e

6条回答
  •  不知归路
    2021-02-02 00:17

    In your Application_Start(), specify which Claim to use as the NameIdentifier:

    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            ...
    
            System.Web.Helpers.AntiForgeryConfig.UniqueClaimTypeIdentifier = 
                System.Security.Claims.ClaimTypes.NameIdentifier;
    
            ...
        }
    }
    

    See: http://brockallen.com/2012/07/08/mvc-4-antiforgerytoken-and-claims/

提交回复
热议问题