c# - 如何使用 MS 身份平台在 OnSignIn 之后触发自定义方法
问题描述
我有一个使用 Identity Platform 身份验证的 Blazor .Net 5 应用程序。开箱即用,这一切都很好,但是,我想在 .Net/AzureAD 完成它之后触发我自己的方法,但我不确定如何最好地做到这一点。
因此,用户单击指向@MicrosoftIdentity/Account/SignIn 的“登录”链接,MS 接管并处理所有事情,并按照设置说明返回到回调路径“/signin-oidc”。如何在此过程完成后,我会立即运行以下代码吗?
MyCustomPostSignInLogic()
{
// All my code to run once, post sign in
}
作为一项附加功能,是否还有一种方法可以干预 .Net 自动登录用户,尽管他们已经过身份验证?
MyCustomOverrideSignInLogic()
{
// run this code and perhaps decide not to authenticate a user, despite them successfully completing MS auth. Maybe we have blacklisted a user, and despite them having a valid MS account, don't want them to specifically authenticate against our app.
}
解决方案
推荐阅读
- c# - 从数组中构建 Lambda 选择
- python-3.x - 如何将对象的类型从“pandas.core.groupby.generic.SeriesGroupBy”转换为“pandas.core.series.Series”?
- gitlab-api - Gitlab API。如何在笔记中获取表情符号?
- salesforce - 在 Salesforce 中的何处存储授权持有者令牌?
- python - itertools.combinations 的 numba 安全版本?
- python - 在构建期间将文件复制到 Docker 容器,但进程声称未找到文件
- java - 无法加载 Glass 工厂类 - Windows 上的 OpenJDK OpenJFX
- kubernetes - 如何通过节点 B 路由所有节点 A 流量
- pagination - 如何处理基于光标的分页中先前元素的删除?
- python - 在嵌套列表中查找元素索引