Compare commits

2 Commits
v2.1 ... master

Author SHA1 Message Date
fulexable
fc2f65d8e0 Commit uncommitted local changes before Gitea archival 2026-07-03 05:23:34 +09:00
jwatmore
c662aaa146 updated to ASP.NET Core 2.2 2019-01-07 21:22:19 -08:00
14 changed files with 363 additions and 369 deletions

2
.vscode/launch.json vendored
View File

@@ -10,7 +10,7 @@
"request": "launch", "request": "launch",
"preLaunchTask": "build", "preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path. // 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": [], "args": [],
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"stopAtEntry": false, "stopAtEntry": false,

8
.vscode/tasks.json vendored
View File

@@ -1,15 +1,15 @@
{ {
"version": "0.1.0", "version": "2.0.0",
"command": "dotnet", "command": "dotnet",
"isShellCommand": true, "type": "shell",
"args": [], "args": [],
"tasks": [ "tasks": [
{ {
"taskName": "build", "label": "build",
"args": [ "args": [
"${workspaceRoot}/WebApi.csproj" "${workspaceRoot}/WebApi.csproj"
], ],
"isBuildCommand": true, "group": "build",
"problemMatcher": "$msCompile" "problemMatcher": "$msCompile"
} }
] ]

View File

@@ -1,5 +1,5 @@
# aspnet-core-jwt-authentication-api # 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 For documentation and instructions check out http://jasonwatmore.com/post/2018/08/14/aspnet-core-21-jwt-authentication-tutorial-with-example-api

View File

@@ -2,12 +2,12 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using WebApi.Helpers; using WebApi.Helpers;
using WebApi.Services; using WebApi.Services;
using Microsoft.IdentityModel.Tokens; using Microsoft.IdentityModel.Tokens;
using System.Text; using System.Text;
using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Mvc;
namespace WebApi namespace WebApi
{ {
@@ -24,7 +24,7 @@ namespace WebApi
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
services.AddCors(); services.AddCors();
services.AddMvc(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
// configure strongly typed settings objects // configure strongly typed settings objects
var appSettingsSection = Configuration.GetSection("AppSettings"); 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. // 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 // global cors policy
app.UseCors(x => x app.UseCors(x => x
.AllowAnyOrigin() .AllowAnyOrigin()
.AllowAnyMethod() .AllowAnyMethod()
.AllowAnyHeader() .AllowAnyHeader());
.AllowCredentials());
app.UseAuthentication(); app.UseAuthentication();

View File

@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" /> <PackageReference Include="Microsoft.AspNetCore.App" />

View File

@@ -1,6 +1,5 @@
{ {
"Logging": { "Logging": {
"IncludeScopes": false,
"LogLevel": { "LogLevel": {
"Default": "Debug", "Default": "Debug",
"System": "Information", "System": "Information",

View File

@@ -1,9 +1,8 @@
{ {
"AppSettings": { "AppSettings": {
"Secret": "THIS IS USED TO SIGN AND VERIFY JWT TOKENS, REPLACE IT WITH YOUR OWN SECRET, IT CAN BE ANY STRING" "Secret": "sdfsdf"
}, },
"Logging": { "Logging": {
"IncludeScopes": false,
"LogLevel": { "LogLevel": {
"Default": "Warning" "Default": "Warning"
} }