|
|
|
@ -4,6 +4,7 @@ using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using System.Security.Claims; |
|
|
|
using IdentityModel; |
|
|
|
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Cors; |
|
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
|
@ -103,12 +104,12 @@ namespace MyCompanyName.MyProjectName |
|
|
|
AbpClaimTypes.Role = JwtClaimTypes.Role; |
|
|
|
AbpClaimTypes.Email = JwtClaimTypes.Email; |
|
|
|
|
|
|
|
context.Services.AddAuthentication("Bearer") |
|
|
|
.AddIdentityServerAuthentication(options => |
|
|
|
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) |
|
|
|
.AddJwtBearer(options => |
|
|
|
{ |
|
|
|
options.Authority = configuration["AuthServer:Authority"]; |
|
|
|
options.RequireHttpsMetadata = false; |
|
|
|
options.ApiName = "MyProjectName"; |
|
|
|
options.Audience = "MyProjectName"; |
|
|
|
}); |
|
|
|
|
|
|
|
Configure<AbpDistributedCacheOptions>(options => |
|
|
|
@ -163,7 +164,7 @@ namespace MyCompanyName.MyProjectName |
|
|
|
app.UseCorrelationId(); |
|
|
|
app.UseVirtualFiles(); |
|
|
|
app.UseRouting(); |
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
app.UseAuthentication(); |
|
|
|
app.UseAbpClaimsMap(); |
|
|
|
if (MultiTenancyConsts.IsEnabled) |
|
|
|
|