【发布时间】:2018-03-29 21:09:04
【问题描述】:
【问题讨论】:
标签: oauth asp.net-core identityserver4
【问题讨论】:
标签: oauth asp.net-core identityserver4
是的,这是可能的。
您需要确保在 ConfigureServices 中正确设置身份验证方案。
services.AddAuthentication()
.AddCookie("MyCookieAuthenticationScheme", options => {
})
.AddAnotherHandler("AnotherName", options => { });
然后对于每个控制器/动作,您需要指定符合条件的方案
例子:
[Authorize(AuthenticationSchemes = "Scheme1")]
public IActionResult Test1() { }
[Authorize(AuthenticationSchemes = "Scheme2")]
public IActionResult Test2() { }
[Authorize(AuthenticationSchemes = "Scheme1,Scheme2")]
public IActionResult Test3() { }
如果需要,您还可以创建自己的身份验证处理程序。
祝你好运, 赛博
【讨论】: