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",
"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,

8
.vscode/tasks.json vendored
View File

@@ -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"
}
]

View File

@@ -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

View File

@@ -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();

View File

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

View File

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

View File

@@ -1,9 +1,8 @@
{
"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": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}