예제 #1
0
 public static void ConfigureJwt(this IServiceCollection services, Microsoft.Extensions.Configuration.IConfiguration config)
 {
     services.AddAuthentication(options =>
     {
         options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
         options.DefaultChallengeScheme    = JwtBearerDefaults.AuthenticationScheme;
         options.DefaultScheme             = JwtBearerDefaults.AuthenticationScheme;
     })
     .AddJwtBearer(options =>
     {
         options.SaveToken                 = true;
         options.RequireHttpsMetadata      = false;
         options.TokenValidationParameters = config.GetTokenValidationParameters();
     });
 }