|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Cors; |
|
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
|
@ -88,12 +89,12 @@ namespace MyCompanyName.MyProjectName |
|
|
|
|
|
|
|
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) |
|
|
|
{ |
|
|
|
context.Services.AddAuthentication("Bearer") |
|
|
|
.AddIdentityServerAuthentication(options => |
|
|
|
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) |
|
|
|
.AddJwtBearer(options => |
|
|
|
{ |
|
|
|
options.Authority = configuration["AuthServer:Authority"]; |
|
|
|
options.RequireHttpsMetadata = true; |
|
|
|
options.ApiName = "MyProjectName"; |
|
|
|
options.RequireHttpsMetadata = false; |
|
|
|
options.Audience = "MyProjectName"; |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|