User.IsInRole doesn't work

后端 未结 16 1380
北恋
北恋 2020-12-05 18:29

I have ASP.NET MVC 4 application. I use Simple Membership Provider allowing to tick remember me checkbox under login form. If ticked, persitent cookie .ASPXAUTH is created w

16条回答
  •  独厮守ぢ
    2020-12-05 19:00

    None of these answers worked for me, but I did find the answer here: https://thinkthencode.wordpress.com/2016/04/24/azure-ad-using-app-roles-for-authorization/

    The key was adding the following to Startup.Auth.cs:

    TokenValidationParameters = new TokenValidationParameters
    {
        RoleClaimType = "roles"
    }
    

提交回复
热议问题