From c662aaa146eb3655089a9d93bdd0fa1f52afe2f6 Mon Sep 17 00:00:00 2001 From: jwatmore Date: Mon, 7 Jan 2019 21:22:19 -0800 Subject: [PATCH] updated to ASP.NET Core 2.2 --- .vscode/launch.json | 2 +- .vscode/tasks.json | 8 ++++---- README.md | 2 +- Startup.cs | 14 +++++--------- WebApi.csproj | 2 +- appsettings.Development.json | 1 - appsettings.json | 1 - 7 files changed, 12 insertions(+), 18 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 7d5f87e..b93a68d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "preLaunchTask": "build", // If you have changed target frameworks, make sure to update the program path. - "program": "${workspaceRoot}/bin/Debug/netcoreapp2.1/WebApi.dll", + "program": "${workspaceRoot}/bin/Debug/netcoreapp2.2/WebApi.dll", "args": [], "cwd": "${workspaceRoot}", "stopAtEntry": false, diff --git a/.vscode/tasks.json b/.vscode/tasks.json index cb5ab8d..99a9733 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,15 +1,15 @@ { - "version": "0.1.0", + "version": "2.0.0", "command": "dotnet", - "isShellCommand": true, + "type": "shell", "args": [], "tasks": [ { - "taskName": "build", + "label": "build", "args": [ "${workspaceRoot}/WebApi.csproj" ], - "isBuildCommand": true, + "group": "build", "problemMatcher": "$msCompile" } ] diff --git a/README.md b/README.md index 0b7035a..0cf0067 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # aspnet-core-jwt-authentication-api -ASP.NET Core 2.1 - JWT Authentication API +ASP.NET Core 2.2 - JWT Authentication API For documentation and instructions check out http://jasonwatmore.com/post/2018/08/14/aspnet-core-21-jwt-authentication-tutorial-with-example-api diff --git a/Startup.cs b/Startup.cs index 3843bcc..0dee30f 100644 --- a/Startup.cs +++ b/Startup.cs @@ -2,16 +2,16 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; using WebApi.Helpers; using WebApi.Services; using Microsoft.IdentityModel.Tokens; using System.Text; using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Mvc; namespace WebApi { - public class Startup + public class Startup { public Startup(IConfiguration configuration) { @@ -24,7 +24,7 @@ namespace WebApi public void ConfigureServices(IServiceCollection services) { services.AddCors(); - services.AddMvc(); + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); // configure strongly typed settings objects var appSettingsSection = Configuration.GetSection("AppSettings"); @@ -56,17 +56,13 @@ namespace WebApi } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) + public void Configure(IApplicationBuilder app, IHostingEnvironment env) { - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - // global cors policy app.UseCors(x => x .AllowAnyOrigin() .AllowAnyMethod() - .AllowAnyHeader() - .AllowCredentials()); + .AllowAnyHeader()); app.UseAuthentication(); diff --git a/WebApi.csproj b/WebApi.csproj index 3046078..759d7b4 100644 --- a/WebApi.csproj +++ b/WebApi.csproj @@ -1,6 +1,6 @@  - netcoreapp2.1 + netcoreapp2.2 diff --git a/appsettings.Development.json b/appsettings.Development.json index fa8ce71..0623a3f 100644 --- a/appsettings.Development.json +++ b/appsettings.Development.json @@ -1,6 +1,5 @@ { "Logging": { - "IncludeScopes": false, "LogLevel": { "Default": "Debug", "System": "Information", diff --git a/appsettings.json b/appsettings.json index 9c74b39..cc1a255 100644 --- a/appsettings.json +++ b/appsettings.json @@ -3,7 +3,6 @@ "Secret": "THIS IS USED TO SIGN AND VERIFY JWT TOKENS, REPLACE IT WITH YOUR OWN SECRET, IT CAN BE ANY STRING" }, "Logging": { - "IncludeScopes": false, "LogLevel": { "Default": "Warning" }