我想实现2种身份验证方案,但是我的代码出现错误
分配给AuthSchemes的表达式必须为常量
代码:
[Authorize(AuthenticationSchemes = AuthSchemes )]
[Route("api/[controller]")]
[ApiController]
public class SomeController : ControllerBase
{
private const string AuthSchemes =
IdentityConstants.ApplicationScheme + "," +
JwtBearerDefaults.AuthenticationScheme;
但是我可以这样做
private const string AuthSchemes =
"Identity.Application" + "," +
JwtBearerDefaults.AuthenticationScheme;
如何解决第一个实现?