Re-challenge authenticated users in ASP.NET Core

前端 未结 2 1676
不思量自难忘°
不思量自难忘° 2021-02-15 21:55

I\'m running into some issues with the authentication pipeline in ASP.NET Core. My scenario is that I want to issue a challenge to a user who is already authenticated using Open

2条回答
  •  孤城傲影
    2021-02-15 22:42

    I found a hint and the solution here: https://github.com/aspnet/Security/issues/912. ChallengeBehavior.Unauthorized is the "key".

    This post gives the current (november 2016 - ASPNet 1.0.1) workaround: https://joonasw.net/view/azure-ad-b2c-with-aspnet-core

    You'll need a new ActionResult to be able to call the AuthauticationManager.ChallengeAsync with the ChallengeBehavior.Unauthorized behavior.

    Once the issue https://github.com/aspnet/Mvc/issues/5187 will be sucessfully closed, this should be integrated.

    I tested it and it worked perfectly well (my goal was simply to extend Google scopes on a per user basis).

提交回复
热议问题