且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在 ASP.NET Core 中重新质询经过身份验证的用户

更新时间:2023-11-30 18:21:22

我在这里找到了提示和解决方案:https://github.com/aspnet/Security/issues/912.ChallengeBehavior.Unauthorized 是关键".

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

这篇文章给出了当前(2016 年 11 月 - ASPNet 1.0.1)的解决方法:https://joonasw.net/view/azure-ad-b2c-with-aspnet-core

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

您需要一个新的 ActionResult 才能使用 ChallengeBehavior.Unauthorized 行为调用 AuthauticationManager.ChallengeAsync.

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

一旦问题https://github.com/aspnet/Mvc/issues/5187 将成功关闭,这应该被集成.

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

我对其进行了测试,它运行良好(我的目标只是根据每个用户扩展 Google 范围).

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