DotNetCore 2.1 -> 2.0
Certificate Kettel instead of IISExpress
This commit is contained in:
@@ -9,7 +9,7 @@ using LaDOSE.Entity;
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.HttpsPolicy;
|
||||
//using Microsoft.AspNetCore.HttpsPolicy;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@@ -36,7 +36,7 @@ namespace LaDOSE.Api
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddCors();
|
||||
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
|
||||
services.AddMvc();
|
||||
services.AddDbContextPool<LaDOSEDbContext>( // replace "YourDbContext" with the class name of your DbContext
|
||||
options => options.UseMySql("Server=localhost;Database=ladose;User=root;Password=;", // replace with your Connection String
|
||||
mysqlOptions =>
|
||||
@@ -45,7 +45,7 @@ namespace LaDOSE.Api
|
||||
}
|
||||
));
|
||||
|
||||
var key = Encoding.ASCII.GetBytes("this is my custom Secret key for authnetication");
|
||||
var key = Encoding.ASCII.GetBytes(this.Configuration["JWTTokenSecret"]);
|
||||
services.AddAuthentication(x =>
|
||||
{
|
||||
x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
|
||||
@@ -95,17 +95,14 @@ namespace LaDOSE.Api
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
app.UseHsts();
|
||||
}
|
||||
|
||||
app.UseCors(x => x
|
||||
.AllowAnyOrigin()
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader()
|
||||
.AllowCredentials());
|
||||
|
||||
app.UseHttpsRedirection();
|
||||
//app.UseHttpsRedirection();
|
||||
app.UseAuthentication();
|
||||
app.UseMvc();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user