Browse Source
Merge pull request #2449 from abpframework/maliming/patch-2
Updates AbpClaimTypes to be compatible with identity server claims.
pull/2483/head
Halil İbrahim Kalkan
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
8 additions and
0 deletions
-
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.IO; |
|
|
|
using System.Linq; |
|
|
|
using IdentityModel; |
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
using Microsoft.AspNetCore.Cors; |
|
|
|
using Microsoft.AspNetCore.DataProtection; |
|
|
|
@ -23,6 +24,7 @@ using Volo.Abp.Localization; |
|
|
|
using Volo.Abp.Modularity; |
|
|
|
using Volo.Abp.MultiTenancy; |
|
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
|
using Volo.Abp.Security.Claims; |
|
|
|
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|
|
|
using Volo.Abp.VirtualFileSystem; |
|
|
|
|
|
|
|
@ -86,6 +88,12 @@ namespace MyCompanyName.MyProjectName |
|
|
|
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); |
|
|
|
}); |
|
|
|
|
|
|
|
//Updates AbpClaimTypes to be compatible with identity server claims.
|
|
|
|
AbpClaimTypes.UserId = JwtClaimTypes.Subject; |
|
|
|
AbpClaimTypes.UserName = JwtClaimTypes.Name; |
|
|
|
AbpClaimTypes.Role = JwtClaimTypes.Role; |
|
|
|
AbpClaimTypes.Email = JwtClaimTypes.Email; |
|
|
|
|
|
|
|
context.Services.AddAuthentication("Bearer") |
|
|
|
.AddIdentityServerAuthentication(options => |
|
|
|
{ |
|
|
|
|