Skip to content

Commit c662aaa

Browse files
committed
updated to ASP.NET Core 2.2
1 parent d0cc8a9 commit c662aaa

7 files changed

+12
-18
lines changed

.vscode/launch.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"request": "launch",
1111
"preLaunchTask": "build",
1212
// If you have changed target frameworks, make sure to update the program path.
13-
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.1/WebApi.dll",
13+
"program": "${workspaceRoot}/bin/Debug/netcoreapp2.2/WebApi.dll",
1414
"args": [],
1515
"cwd": "${workspaceRoot}",
1616
"stopAtEntry": false,

.vscode/tasks.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
2-
"version": "0.1.0",
2+
"version": "2.0.0",
33
"command": "dotnet",
4-
"isShellCommand": true,
4+
"type": "shell",
55
"args": [],
66
"tasks": [
77
{
8-
"taskName": "build",
8+
"label": "build",
99
"args": [
1010
"${workspaceRoot}/WebApi.csproj"
1111
],
12-
"isBuildCommand": true,
12+
"group": "build",
1313
"problemMatcher": "$msCompile"
1414
}
1515
]

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# aspnet-core-jwt-authentication-api
22

3-
ASP.NET Core 2.1 - JWT Authentication API
3+
ASP.NET Core 2.2 - JWT Authentication API
44

55
For documentation and instructions check out http://jasonwatmore.com/post/2018/08/14/aspnet-core-21-jwt-authentication-tutorial-with-example-api

Startup.cs

+5-9
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
using Microsoft.AspNetCore.Hosting;
33
using Microsoft.Extensions.Configuration;
44
using Microsoft.Extensions.DependencyInjection;
5-
using Microsoft.Extensions.Logging;
65
using WebApi.Helpers;
76
using WebApi.Services;
87
using Microsoft.IdentityModel.Tokens;
98
using System.Text;
109
using Microsoft.AspNetCore.Authentication.JwtBearer;
10+
using Microsoft.AspNetCore.Mvc;
1111

1212
namespace WebApi
1313
{
14-
public class Startup
14+
public class Startup
1515
{
1616
public Startup(IConfiguration configuration)
1717
{
@@ -24,7 +24,7 @@ public Startup(IConfiguration configuration)
2424
public void ConfigureServices(IServiceCollection services)
2525
{
2626
services.AddCors();
27-
services.AddMvc();
27+
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
2828

2929
// configure strongly typed settings objects
3030
var appSettingsSection = Configuration.GetSection("AppSettings");
@@ -56,17 +56,13 @@ public void ConfigureServices(IServiceCollection services)
5656
}
5757

5858
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
59-
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
59+
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
6060
{
61-
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
62-
loggerFactory.AddDebug();
63-
6461
// global cors policy
6562
app.UseCors(x => x
6663
.AllowAnyOrigin()
6764
.AllowAnyMethod()
68-
.AllowAnyHeader()
69-
.AllowCredentials());
65+
.AllowAnyHeader());
7066

7167
app.UseAuthentication();
7268

WebApi.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
3-
<TargetFramework>netcoreapp2.1</TargetFramework>
3+
<TargetFramework>netcoreapp2.2</TargetFramework>
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageReference Include="Microsoft.AspNetCore.App" />

appsettings.Development.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"Logging": {
3-
"IncludeScopes": false,
43
"LogLevel": {
54
"Default": "Debug",
65
"System": "Information",

appsettings.json

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"Secret": "THIS IS USED TO SIGN AND VERIFY JWT TOKENS, REPLACE IT WITH YOUR OWN SECRET, IT CAN BE ANY STRING"
44
},
55
"Logging": {
6-
"IncludeScopes": false,
76
"LogLevel": {
87
"Default": "Warning"
98
}

0 commit comments

Comments
 (0)