aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Should HttpSysDefaults.AuthenticationScheme be a const string?

Open withkittens opened this issue 8 years ago • 1 comments

Right now it is a readonly field and is disallowed to use in a const context. Also this is inconsistency with other authentication packages like JwtBearer.

Expected result

This should compile:

[Authorize(AuthenticationSchemes = HttpSysDefaults.AuthenticationScheme)]
public class FooController : Controller
{
    // ...
}

Actual result

CS0182 compilation error: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type.

withkittens avatar Feb 27 '18 00:02 withkittens

This would be a breaking change in a minor release.

muratg avatar Feb 28 '18 00:02 muratg