c# - 除非明确指定,否则为什么不使用默认身份验证模式?
问题描述
这就是我设置默认方案的方式:
services.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme)
.AddIdentityServerAuthentication();
如果我在我的控制器上使用它,它可以工作:
[Authorize(AuthenticationSchemas = IdentityServerAuthenticationDefaults.AuthenticationScheme)]
但是,如果我将其替换为仅[Authorize]
响应变为Unauthorized
. 我希望[Authorize]
工作相同,因为该方案已设置为默认值。
这可能是什么原因?
解决方案
推荐阅读
- android - 有没有更好的方法来更新 jetpack compose 中的文本?
- jquery - 如何在单独的弹出窗口中呈现 React 组件?
- vb.net - 从一个文件中读取文本,以检查其他文本文件是否匹配
- python - 使用 Python pysnmp 拉取交换机 SNMP 社区列表
- .net - 防止 Trimmer/Linker 分析程序集
- javascript - 一个简单的 fetch 产生两个 API 调用
- html - 为什么绝对定位的容器会导致其子级在动画时晃动?
- bamboo - 为什么在 Bamboo 中发布工件需要很长时间?
- ios - iOS如何使用转义序列在字符串中实现上标(\n,\t,\r)
- python - 使用 matplotlib 进行线性回归绘图