相关疑难解决方法(0)

使用 System.IdentityModel.Tokens.Jwt - 5.1.4 更新从 1.1 迁移到 2.0 后,JWTAuthentication 在 asp.net core 2.0 中不起作用

错误

错误 CS0619 'JwtBearerAppBuilderExtensions.UseJwtBearerAuthentication(IApplicationBuilder, JwtBearerOptions)' 已过时:'请参阅https://go.microsoft.com/fwlink/?linkid=845470 '

这是 JWT 身份验证的代码

app.UseJwtBearerAuthentication(new JwtBearerOptions
            {
                TokenValidationParameters = new TokenValidationParameters
                {
                    IssuerSigningKey = key,
                    ValidAudience = tokenOptions.Audience,
                    ValidIssuer = tokenOptions.Issuer,

                    // When receiving a token, check that it is still valid.
                    ValidateLifetime = true,

                    // This defines the maximum allowable clock skew - i.e. provides a tolerance on the token expiry time 
                    // when validating the lifetime. As we're creating the tokens locally and validating them on the same 
                    // machines which …
Run Code Online (Sandbox Code Playgroud)

c# asp.net asp.net-mvc jwt asp.net-core

5
推荐指数
1
解决办法
3276
查看次数

标签 统计

asp.net ×1

asp.net-core ×1

asp.net-mvc ×1

c# ×1

jwt ×1