From a7bd380e742bc7d5ef15cd824245d8074be656de Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Wed, 20 May 2020 11:53:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BA=AB=E4=BB=BD=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AbpIdentityServerErrorConsts.cs | 20 + ...ntityServerPermissionDefinitionProvider.cs | 11 + .../AbpIdentityServerPermissions.cs | 15 + .../Clients/Dto/ClientCloneInputDto.cs | 4 +- .../IdentityResources/Dto/IdentityClaimDto.cs | 7 + .../Dto/IdentityResourceCreateDto.cs | 37 ++ .../Dto/IdentityResourceDto.cs | 39 ++ .../Dto/IdentityResourceGetByIdInputDto.cs | 9 + .../Dto/IdentityResourceGetByPagedInputDto.cs | 9 + .../Dto/IdentityResourcePropertyCreateDto.cs | 23 ++ .../Dto/IdentityResourcePropertyDto.cs | 9 + .../IdentityResourcePropertyGetByKeyDto.cs | 15 + .../Dto/IdentityResourceUpdateDto.cs | 44 +++ .../IIdentityResourceAppService.cs | 23 ++ .../Localization/Resources/en.json | 8 +- .../Localization/Resources/zh-Hans.json | 8 +- .../AbpIdentityServerAutoMapperProfile.cs | 19 + .../ApiResources/ApiResourceAppService.cs | 6 + .../IdentityResourceAppService.cs | 121 ++++++ .../IdentityResourceController.cs | 66 ++++ aspnet-core/services/start-all.bat | 6 + .../services/start-apigateway-host.cmd | 2 +- vueJs/src/api/identityresources.ts | 245 ++++++++++++ vueJs/src/api/types.ts | 1 + vueJs/src/lang/zh.ts | 69 +++- vueJs/src/router/index.ts | 12 +- .../ApiResourceCreateOrEditForm.vue | 14 +- .../components/ApiResourceScopeEditForm.vue | 7 +- .../components/ApiResourceSecretEditForm.vue | 5 +- .../identityServer/api-resources/index.vue | 14 +- .../client/components/ClientEditForm.vue | 9 +- .../IdentityResourceCreateOrEditForm.vue | 196 ++++++++++ .../IdentityResourcePropertyEditForm.vue | 173 +++++++++ .../identity-resources/index.vue | 367 ++++++++++++++++++ .../admin/users/components/UserProfile.vue | 34 +- vueJs/src/views/admin/users/index.vue | 1 + 36 files changed, 1596 insertions(+), 52 deletions(-) create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityClaimDto.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceCreateDto.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceDto.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByIdInputDto.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByPagedInputDto.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyCreateDto.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyDto.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyGetByKeyDto.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceUpdateDto.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/IIdentityResourceAppService.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceAppService.cs create mode 100644 aspnet-core/modules/identityServer/LINGYUN.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceController.cs create mode 100644 aspnet-core/services/start-all.bat create mode 100644 vueJs/src/api/identityresources.ts create mode 100644 vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourceCreateOrEditForm.vue create mode 100644 vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourcePropertyEditForm.vue create mode 100644 vueJs/src/views/admin/identityServer/identity-resources/index.vue diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerErrorConsts.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerErrorConsts.cs index 9ff1b657b..d766260f1 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerErrorConsts.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerErrorConsts.cs @@ -7,6 +7,21 @@ /// public const string ClientIdExisted = "ClientIdExisted"; + /// + /// Api资源已经存在 + /// + public const string ApiResourceNameExisted = "ApiResourceNameExisted"; + + /// + /// 身份资源已经存在 + /// + public const string IdentityResourceNameExisted = "IdentityResourceNameExisted"; + + /// + /// 身份资源属性已经存在 + /// + public const string IdentityResourcePropertyExisted = "IdentityResourcePropertyExisted"; + /// /// 客户端声明不存在 /// @@ -21,5 +36,10 @@ /// 客户端属性不存在 /// public const string ClientPropertyNotFound = "ClientPropertyNotFound"; + + /// + /// 身份资源属性不存在 + /// + public const string IdentityResourcePropertyNotFound = "IdentityResourcePropertyNotFound"; } } diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissionDefinitionProvider.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissionDefinitionProvider.cs index a6496de60..8d94c49b8 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissionDefinitionProvider.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissionDefinitionProvider.cs @@ -55,6 +55,17 @@ namespace LINGYUN.Abp.IdentityServer apiResourceSecretPermissions.AddChild(AbpIdentityServerPermissions.ApiResources.Secrets.Create, L("Permissions:Create")); apiResourceSecretPermissions.AddChild(AbpIdentityServerPermissions.ApiResources.Secrets.Update, L("Permissions:Update")); apiResourceSecretPermissions.AddChild(AbpIdentityServerPermissions.ApiResources.Secrets.Delete, L("Permissions:Delete")); + + // 身份资源权限 + var identityResourcePermissions = identityServerGroup.AddPermission(AbpIdentityServerPermissions.IdentityResources.Default, L("Permissions:IdentityResources")); + identityResourcePermissions.AddChild(AbpIdentityServerPermissions.IdentityResources.Create, L("Permissions:Create")); + identityResourcePermissions.AddChild(AbpIdentityServerPermissions.IdentityResources.Update, L("Permissions:Update")); + identityResourcePermissions.AddChild(AbpIdentityServerPermissions.IdentityResources.Delete, L("Permissions:Delete")); + + // 身份资源属性权限 + var identityResourcePropertyPermissiosn = identityResourcePermissions.AddChild(AbpIdentityServerPermissions.IdentityResources.Properties.Default, L("Permissions:IdentityResources:Properties")); + identityResourcePropertyPermissiosn.AddChild(AbpIdentityServerPermissions.IdentityResources.Properties.Create, L("Permissions:Create")); + identityResourcePropertyPermissiosn.AddChild(AbpIdentityServerPermissions.IdentityResources.Properties.Delete, L("Permissions:Delete")); } protected virtual LocalizableString L(string name) diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissions.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissions.cs index f932ddcc2..5dbe0c40a 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissions.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/AbpIdentityServerPermissions.cs @@ -62,5 +62,20 @@ public const string Delete = Default + ".Delete"; } } + + public static class IdentityResources + { + public const string Default = GroupName + ".IdentityResources"; + public const string Create = Default + ".Create"; + public const string Update = Default + ".Update"; + public const string Delete = Default + ".Delete"; + + public static class Properties + { + public const string Default = IdentityResources.Default + ".Properties"; + public const string Create = Default + ".Create"; + public const string Delete = Default + ".Delete"; + } + } } } diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCloneInputDto.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCloneInputDto.cs index 26beea5d9..752c384de 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCloneInputDto.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCloneInputDto.cs @@ -53,11 +53,11 @@ namespace LINGYUN.Abp.IdentityServer.Clients /// public bool CopyPostLogoutRedirectUri { get; set; } /// - /// 客户端 IdP 限制 + /// 复制客户端属性 /// public bool CopyPropertie { get; set; } /// - /// 复制客户端属性 + /// 复制客户端 IdP 限制 /// public bool CopyIdentityProviderRestriction { get; set; } public ClientCloneInputDto() diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityClaimDto.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityClaimDto.cs new file mode 100644 index 000000000..752291084 --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityClaimDto.cs @@ -0,0 +1,7 @@ +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + public class IdentityClaimDto + { + public string Type { get; set; } + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceCreateDto.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceCreateDto.cs new file mode 100644 index 000000000..efb8f9278 --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceCreateDto.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.IdentityServer.IdentityResources; + +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + public class IdentityResourceCreateDto + { + [Required] + [StringLength(IdentityResourceConsts.NameMaxLength)] + public string Name { get; set; } + + [StringLength(IdentityResourceConsts.DisplayNameMaxLength)] + public string DisplayName { get; set; } + + [StringLength(IdentityResourceConsts.DescriptionMaxLength)] + public string Description { get; set; } + + public bool Enabled { get; set; } + + public bool Required { get; set; } + + public bool Emphasize { get; set; } + + public bool ShowInDiscoveryDocument { get; set; } + + public List UserClaims { get; set; } + + public IdentityResourceCreateDto() + { + Enabled = true; + Required = false; + ShowInDiscoveryDocument = false; + UserClaims = new List(); + } + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceDto.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceDto.cs new file mode 100644 index 000000000..b72617fdd --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceDto.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Application.Dtos; +using Volo.Abp.IdentityServer.IdentityResources; + +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + public class IdentityResourceDto : FullAuditedEntityDto + { + public string Name { get; set; } + + + public string DisplayName { get; set; } + + + public string Description { get; set; } + + public string ConcurrencyStamp { get; set; } + + public bool Enabled { get; set; } + + public bool Required { get; set; } + + public bool Emphasize { get; set; } + + public bool ShowInDiscoveryDocument { get; set; } + + public List UserClaims { get; set; } + + public List Properties { get; set; } + + public IdentityResourceDto() + { + UserClaims = new List(); + Properties = new List(); + } + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByIdInputDto.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByIdInputDto.cs new file mode 100644 index 000000000..5bf778a73 --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByIdInputDto.cs @@ -0,0 +1,9 @@ +using System; +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + public class IdentityResourceGetByIdInputDto : EntityDto + { + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByPagedInputDto.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByPagedInputDto.cs new file mode 100644 index 000000000..cc42d784e --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByPagedInputDto.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Application.Dtos; + +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + public class IdentityResourceGetByPagedInputDto : PagedAndSortedResultRequestDto + { + public string Filter { get; set; } + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyCreateDto.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyCreateDto.cs new file mode 100644 index 000000000..94d02ff5f --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyCreateDto.cs @@ -0,0 +1,23 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + public class IdentityResourcePropertyCreateDto + { + [Required] + public Guid IdentityResourceId { get; set; } + + [Required] + [StringLength(2000)] + public string ConcurrencyStamp { get; set; } + + [Required] + [StringLength(100)] + public string Key { get; set; } + + [Required] + [StringLength(2000)] + public string Value { get; set; } + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyDto.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyDto.cs new file mode 100644 index 000000000..ef44166d1 --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyDto.cs @@ -0,0 +1,9 @@ +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + public class IdentityResourcePropertyDto + { + public string Key { get; set; } + + public string Value { get; set; } + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyGetByKeyDto.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyGetByKeyDto.cs new file mode 100644 index 000000000..ea2cb0a30 --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyGetByKeyDto.cs @@ -0,0 +1,15 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + public class IdentityResourcePropertyGetByKeyDto + { + [Required] + public Guid IdentityResourceId { get; set; } + + [Required] + [StringLength(100)] + public string Key { get; set; } + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceUpdateDto.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceUpdateDto.cs new file mode 100644 index 000000000..5a9d4e18a --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceUpdateDto.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.IdentityServer.IdentityResources; + +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + public class IdentityResourceUpdateDto + { + [Required] + public Guid Id { get; set; } + + [Required] + [StringLength(2000)] + public string ConcurrencyStamp { get; set; } + + [StringLength(IdentityResourceConsts.NameMaxLength)] + public string Name { get; set; } + + [StringLength(IdentityResourceConsts.DisplayNameMaxLength)] + public string DisplayName { get; set; } + + [StringLength(IdentityResourceConsts.DescriptionMaxLength)] + public string Description { get; set; } + + public bool Enabled { get; set; } + + public bool Required { get; set; } + + public bool Emphasize { get; set; } + + public bool ShowInDiscoveryDocument { get; set; } + + public List UserClaims { get; set; } + + public IdentityResourceUpdateDto() + { + Enabled = true; + Required = false; + ShowInDiscoveryDocument = false; + UserClaims = new List(); + } + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/IIdentityResourceAppService.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/IIdentityResourceAppService.cs new file mode 100644 index 000000000..5b89e7d96 --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/IIdentityResourceAppService.cs @@ -0,0 +1,23 @@ +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Application.Services; + +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + public interface IIdentityResourceAppService : IApplicationService + { + Task GetAsync(IdentityResourceGetByIdInputDto identityResourceGetById); + + Task> GetAsync(IdentityResourceGetByPagedInputDto identityResourceGetByPaged); + + Task CreateAsync(IdentityResourceCreateDto identityResourceCreate); + + Task UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate); + + Task DeleteAsync(IdentityResourceGetByIdInputDto identityResourceGetById); + + Task AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate); + + Task DeletePropertyAsync(IdentityResourcePropertyGetByKeyDto identityResourcePropertyGetByKey); + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/en.json b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/en.json index c106fa687..81c9ce62b 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/en.json +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/en.json @@ -16,9 +16,15 @@ "Permissions:ApiResources": "ApiResources", "Permissions:ApiResources:Scope": "Api scope", "Permissions:ApiResources:Secrets": "Api secret", + "Permissions:IdentityResources": "IdentityResources", + "Permissions:IdentityResources:Properties": "Identity property", "ClientIdExisted": "Client id: {0} already exists!", + "ApiResourceNameExisted": "Api resource name: {0} already exists!", + "IdentityResourceNameExisted": "Identity resource name: {0} already exists!", + "IdentityResourcePropertyExisted": "Identity resource property: {0} already exists!", "ClientClaimNotFound": "Client claim: {0} not found!", "ClientSecretNotFound": "Client secret: {0} not found!", - "ClientPropertyNotFound": "Client property: {0} not found!" + "ClientPropertyNotFound": "Client property: {0} not found!", + "IdentityResourcePropertyNotFound": "Identity resource property: {0} not found!" } } \ No newline at end of file diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/zh-Hans.json b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/zh-Hans.json index 285f91275..db3ae18ee 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/zh-Hans.json @@ -16,9 +16,15 @@ "Permissions:ApiResources": "Api资源管理", "Permissions:ApiResources:Scope": "授权范围", "Permissions:ApiResources:Secrets": "Api密钥", + "Permissions:IdentityResources": "身份资源管理", + "Permissions:IdentityResources:Properties": "身份资源属性", "ClientIdExisted": "客户端标识: {0} 已经存在!", + "ApiResourceNameExisted": "Api资源: {0} 已经存在!", + "IdentityResourceNameExisted": "身份资源: {0} 已经存在!", + "IdentityResourcePropertyExisted": "身份资源属性: {0} 已经存在!", "ClientClaimNotFound": "客户端声明: {0} 不存在!", "ClientSecretNotFound": "客户端密钥: {0} 不存在!", - "ClientPropertyNotFound": "客户端属性: {0} 不存在!" + "ClientPropertyNotFound": "客户端属性: {0} 不存在!", + "IdentityResourcePropertyNotFound": "身份资源属性: {0} 不存在!" } } \ No newline at end of file diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs index db5bdfd9e..1251a2262 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs @@ -1,8 +1,11 @@ using AutoMapper; using LINGYUN.Abp.IdentityServer.ApiResources; using LINGYUN.Abp.IdentityServer.Clients; +using LINGYUN.Abp.IdentityServer.IdentityResources; +using System.Collections.Generic; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.IdentityResources; namespace LINGYUN.Abp.IdentityServer { @@ -26,6 +29,22 @@ namespace LINGYUN.Abp.IdentityServer CreateMap(); CreateMap(); CreateMap(); + + CreateMap(); + CreateMap() + .ForMember(dto => dto.Properties, map => map.MapFrom((src, d) => + { + var properties = new List(); + foreach (var property in src.Properties) + { + properties.Add(new IdentityResourcePropertyDto + { + Key = property.Key, + Value = property.Value + }); + } + return properties; + })); } } } diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceAppService.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceAppService.cs index 2356b7492..2b35871ed 100644 --- a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceAppService.cs +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceAppService.cs @@ -3,6 +3,7 @@ using IdentityServer4.Models; using Microsoft.AspNetCore.Authorization; using System.Collections.Generic; using System.Threading.Tasks; +using Volo.Abp; using Volo.Abp.Application.Dtos; using Volo.Abp.IdentityServer.ApiResources; using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; @@ -40,6 +41,11 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources [Authorize(AbpIdentityServerPermissions.ApiResources.Create)] public virtual async Task CreateAsync(ApiResourceCreateDto apiResourceCreate) { + var apiResourceExists = await ApiResourceRepository.CheckNameExistAsync(apiResourceCreate.Name); + if (apiResourceExists) + { + throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ApiResourceNameExisted, apiResourceCreate.Name]); + } var apiResource = new ApiResource(GuidGenerator.Create(), apiResourceCreate.Name, apiResourceCreate.DisplayName, apiResourceCreate.Description); apiResource.Enabled = apiResourceCreate.Enabled; diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceAppService.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceAppService.cs new file mode 100644 index 000000000..30ffec299 --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.Application/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceAppService.cs @@ -0,0 +1,121 @@ +using Microsoft.AspNetCore.Authorization; +using System.Collections.Generic; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.IdentityServer.IdentityResources; + +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + [Authorize(AbpIdentityServerPermissions.IdentityResources.Default)] + public class IdentityResourceAppService : AbpIdentityServerAppServiceBase, IIdentityResourceAppService + { + protected IIdentityResourceRepository IdentityResourceRepository { get; } + + public IdentityResourceAppService( + IIdentityResourceRepository identityResourceRepository) + { + IdentityResourceRepository = identityResourceRepository; + } + + public virtual async Task GetAsync(IdentityResourceGetByIdInputDto identityResourceGetById) + { + var identityResource = await IdentityResourceRepository.GetAsync(identityResourceGetById.Id); + + return ObjectMapper.Map(identityResource); + } + + public virtual async Task> GetAsync(IdentityResourceGetByPagedInputDto identityResourceGetByPaged) + { + var identityResources = await IdentityResourceRepository.GetListAsync(identityResourceGetByPaged.Sorting, + identityResourceGetByPaged.SkipCount, identityResourceGetByPaged.MaxResultCount, true); + var identityResourceCount = await IdentityResourceRepository.GetCountAsync(); + + return new PagedResultDto(identityResourceCount, + ObjectMapper.Map, List>(identityResources)); + } + + [Authorize(AbpIdentityServerPermissions.IdentityResources.Create)] + public virtual async Task CreateAsync(IdentityResourceCreateDto identityResourceCreate) + { + var identityResourceExists = await IdentityResourceRepository.CheckNameExistAsync(identityResourceCreate.Name); + if (identityResourceExists) + { + throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.IdentityResourceNameExisted, identityResourceCreate.Name]); + } + var identityResource = new IdentityResource(GuidGenerator.Create(), identityResourceCreate.Name, identityResourceCreate.DisplayName, + identityResourceCreate.Description, identityResourceCreate.Enabled, identityResourceCreate.Required, identityResourceCreate.Emphasize, + identityResourceCreate.ShowInDiscoveryDocument); + foreach(var claim in identityResourceCreate.UserClaims) + { + identityResource.AddUserClaim(claim.Type); + } + identityResource = await IdentityResourceRepository.InsertAsync(identityResource); + + return ObjectMapper.Map(identityResource); + } + + [Authorize(AbpIdentityServerPermissions.IdentityResources.Update)] + public virtual async Task UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate) + { + var identityResource = await IdentityResourceRepository.GetAsync(identityResourceUpdate.Id); + identityResource.ConcurrencyStamp = identityResourceUpdate.ConcurrencyStamp; + identityResource.Name = identityResourceUpdate.Name ?? identityResource.Name; + identityResource.DisplayName = identityResourceUpdate.DisplayName ?? identityResource.DisplayName; + identityResource.Description = identityResourceUpdate.Description ?? identityResource.Description; + identityResource.Enabled = identityResourceUpdate.Enabled; + identityResource.Emphasize = identityResourceUpdate.Emphasize; + identityResource.ShowInDiscoveryDocument = identityResourceUpdate.ShowInDiscoveryDocument; + if (identityResourceUpdate.UserClaims.Count > 0) + { + identityResource.RemoveAllUserClaims(); + foreach (var claim in identityResourceUpdate.UserClaims) + { + identityResource.AddUserClaim(claim.Type); + } + } + identityResource = await IdentityResourceRepository.UpdateAsync(identityResource); + + return ObjectMapper.Map(identityResource); + } + + [Authorize(AbpIdentityServerPermissions.IdentityResources.Delete)] + public virtual async Task DeleteAsync(IdentityResourceGetByIdInputDto identityResourceGetById) + { + await IdentityResourceRepository.DeleteAsync(identityResourceGetById.Id); + } + + [Authorize(AbpIdentityServerPermissions.IdentityResources.Properties.Create)] + public virtual async Task AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate) + { + var identityResource = await IdentityResourceRepository.GetAsync(identityResourcePropertyCreate.IdentityResourceId); + + if (identityResource.Properties.ContainsKey(identityResourcePropertyCreate.Key)) + { + throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.IdentityResourcePropertyExisted, identityResourcePropertyCreate.Key]); + } + identityResource.ConcurrencyStamp = identityResourcePropertyCreate.ConcurrencyStamp; + identityResource.Properties.Add(identityResourcePropertyCreate.Key, identityResourcePropertyCreate.Value); + + await IdentityResourceRepository.UpdateAsync(identityResource); + return new IdentityResourcePropertyDto + { + Key = identityResourcePropertyCreate.Key, + Value = identityResourcePropertyCreate.Value + }; + } + + [Authorize(AbpIdentityServerPermissions.IdentityResources.Properties.Delete)] + public virtual async Task DeletePropertyAsync(IdentityResourcePropertyGetByKeyDto identityResourcePropertyGetByKey) + { + var identityResource = await IdentityResourceRepository.GetAsync(identityResourcePropertyGetByKey.IdentityResourceId); + + if (!identityResource.Properties.ContainsKey(identityResourcePropertyGetByKey.Key)) + { + throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.IdentityResourcePropertyNotFound, identityResourcePropertyGetByKey.Key]); + } + identityResource.Properties.Remove(identityResourcePropertyGetByKey.Key); + await IdentityResourceRepository.UpdateAsync(identityResource); + } + } +} diff --git a/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceController.cs b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceController.cs new file mode 100644 index 000000000..8e1e84c05 --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceController.cs @@ -0,0 +1,66 @@ +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp; +using Volo.Abp.Application.Dtos; +using Volo.Abp.AspNetCore.Mvc; + +namespace LINGYUN.Abp.IdentityServer.IdentityResources +{ + [RemoteService(Name = AbpIdentityServerConsts.RemoteServiceName)] + [Area("IdentityServer")] + [Route("api/IdentityServer/IdentityResources")] + public class IdentityResourceController : AbpController, IIdentityResourceAppService + { + protected IIdentityResourceAppService IdentityResourceAppService { get; } + public IdentityResourceController( + IIdentityResourceAppService identityResourceAppService) + { + IdentityResourceAppService = identityResourceAppService; + } + + [HttpGet] + [Route("{Id}")] + public virtual async Task GetAsync(IdentityResourceGetByIdInputDto identityResourceGetById) + { + return await IdentityResourceAppService.GetAsync(identityResourceGetById); + } + + [HttpGet] + public virtual async Task> GetAsync(IdentityResourceGetByPagedInputDto identityResourceGetByPaged) + { + return await IdentityResourceAppService.GetAsync(identityResourceGetByPaged); + } + + [HttpPost] + public virtual async Task CreateAsync(IdentityResourceCreateDto identityResourceCreate) + { + return await IdentityResourceAppService.CreateAsync(identityResourceCreate); + } + + [HttpPut] + public virtual async Task UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate) + { + return await IdentityResourceAppService.UpdateAsync(identityResourceUpdate); + } + + [HttpDelete] + public virtual async Task DeleteAsync(IdentityResourceGetByIdInputDto identityResourceGetById) + { + await IdentityResourceAppService.DeleteAsync(identityResourceGetById); + } + + [HttpPost] + [Route("Properties")] + public virtual async Task AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate) + { + return await IdentityResourceAppService.AddPropertyAsync(identityResourcePropertyCreate); + } + + [HttpDelete] + [Route("Properties")] + public virtual async Task DeletePropertyAsync(IdentityResourcePropertyGetByKeyDto identityResourcePropertyGetByKey) + { + await IdentityResourceAppService.DeletePropertyAsync(identityResourcePropertyGetByKey); + } + } +} diff --git a/aspnet-core/services/start-all.bat b/aspnet-core/services/start-all.bat new file mode 100644 index 000000000..8cc0c065e --- /dev/null +++ b/aspnet-core/services/start-all.bat @@ -0,0 +1,6 @@ +@echo off +cls + +start .\start-identity-server.bat --run +start .\start-apigateway-admin.cmd --run +start .\start-apigateway-host.cmd --run \ No newline at end of file diff --git a/aspnet-core/services/start-apigateway-host.cmd b/aspnet-core/services/start-apigateway-host.cmd index ea73ab8b9..c2548aaff 100644 --- a/aspnet-core/services/start-apigateway-host.cmd +++ b/aspnet-core/services/start-apigateway-host.cmd @@ -9,7 +9,7 @@ cd .\apigateway\LINGYUN.ApiGateway.Host if '%1' equ '--publish' goto publish if '%1' equ '--run' goto run if '%1' equ '--restore' goto restore - +if '%1' equ '' goto run :publish dotnet publish -c Release -o ..\..\Publish\apigateway-host --no-cache --no-restore diff --git a/vueJs/src/api/identityresources.ts b/vueJs/src/api/identityresources.ts new file mode 100644 index 000000000..dcff8cfc8 --- /dev/null +++ b/vueJs/src/api/identityresources.ts @@ -0,0 +1,245 @@ +import ApiService from './serviceBase' +import { pagerFormat } from '@/utils/index' +import { FullAuditedEntityDto, PagedResultDto, PagedAndSortedResultRequestDto } from './types' + +/** 远程服务地址 */ +const serviceUrl = process.env.VUE_APP_BASE_API + +/** 身份资源Api接口 */ +export default class IdentityResourceService { + /** + * 获取身份资源 + * @param id 身份资源标识 + * @returns 返回类型为 IdentityResource 的对象 + */ + public static getIdentityResourceById(id: string) { + let _url = '/api/IdentityServer/IdentityResources/' + _url += id + return ApiService.Get(_url, serviceUrl) + } + + /** + * 获取身份资源列表 + * @param payload 分页查询过滤对象 + * @returns 返回类型为 IdentityResource 的对象列表 + */ + public static getIdentityResources(payload: IdentityResourceGetByPaged) { + let _url = '/api/IdentityServer/IdentityResources' + _url += '?filter=' + payload.filter + _url += '&sorting=' + payload.sorting + _url += '&skipCount=' + pagerFormat(payload.skipCount) + _url += '&maxResultCount=' + payload.maxResultCount + return ApiService.Get>(_url, serviceUrl) + } + + /** + * 创建身份资源 + * @param payload 类型为 IdentityResourceCreate 的对象 + * @returns 返回类型为 IdentityResource 的对象 + */ + public static createIdentityResource(payload: IdentityResourceCreate) { + const _url = '/api/IdentityServer/IdentityResources' + return ApiService.Post(_url, payload, serviceUrl) + } + + /** + * 变更身份资源 + * @param payload 类型为 IdentityResourceUpdate 的对象 + * @returns 返回类型为 IdentityResource 的对象 + */ + public static updateIdentityResource(payload: IdentityResourceUpdate) { + const _url = '/api/IdentityServer/IdentityResources' + return ApiService.Put(_url, payload, serviceUrl) + } + + /** + * 删除身份资源 + * @param id 身份资源标识 + */ + public static deleteIdentityResource(id: string) { + let _url = '/api/IdentityServer/IdentityResources' + _url += '?id=' + id + return ApiService.Delete(_url, serviceUrl) + } + + /** + * 创建身份资源属性 + * @param payload 类型为 IdentityPropertyCreate 的对象 + * @returns 返回类型为 IdentityProperty 的对象 + */ + public static createProperty(payload: IdentityPropertyCreate) { + const _url = '/api/IdentityServer/IdentityResources/Properties' + return ApiService.Post(_url, payload, serviceUrl) + } + + /** + * 删除身份资源属性 + * @param identityResourceId 身份资源标识 + * @param key 身份资源属性键 + */ + public static deleteProperty(identityResourceId: string, key: string) { + let _url = '/api/IdentityServer/IdentityResources/Properties' + _url += '?identityResourceId=' + identityResourceId + _url += '&key=' + key + return ApiService.Delete(_url, serviceUrl) + } +} + +/** 身份资源用户声明 */ +export class IdentityClaim { + /** 用户声明 */ + type = '' +} + +/** 身份资源属性 */ +export class IdentityProperty { + /** 键 */ + key = '' + /** 值 */ + value = '' +} + +/** 身份资源属性创建对象 */ +export class IdentityPropertyCreate { + /** 身份资源标识 */ + identityResourceId = '' + /** 键 */ + key = '' + /** 值 */ + value = '' + /** 并发令牌 */ + concurrencyStamp = '' + + /** 返回一个空对象 */ + public static empty() { + return new IdentityPropertyCreate() + } +} + +/** 身份资源分页查询对象 */ +export class IdentityResourceGetByPaged extends PagedAndSortedResultRequestDto { + /** 过滤参数 */ + filter = '' + + /** 返回一个空对象 */ + public static empty() { + return new IdentityResourceGetByPaged() + } +} + +/** 身份资源创建对象 */ +export class IdentityResourceCreate { + /** 名称 */ + name = '' + /** 显示名称 */ + displayName? = '' + /** 说明 */ + description? = '' + /** 启用 */ + enabled = true + /** 必须 */ + required = false + /** 强调 */ + emphasize = false + /** 在发现文档显示 */ + showInDiscoveryDocument = false + /** 用户声明 */ + userClaims = new Array() + + /** 返回一个空对象 */ + public static empty() { + return new IdentityResourceCreate() + } + + /** 创建身份资源 */ + public static create(identityResource: IdentityResource) { + let resource = new IdentityResourceCreate() + resource.description = identityResource.description + resource.displayName = identityResource.displayName + resource.emphasize = identityResource.emphasize + resource.enabled = identityResource.enabled + resource.name = identityResource.name + resource.required = identityResource.required + resource.showInDiscoveryDocument = identityResource.showInDiscoveryDocument + resource.userClaims = identityResource.userClaims + return resource + } +} + +/** 身份资源变更对象 */ +export class IdentityResourceUpdate { + /** 身份资源标识 */ + id = '' + /** 名称 */ + name = '' + /** 显示名称 */ + displayName? = '' + /** 说明 */ + description? = '' + /** 启用 */ + enabled = true + /** 必须 */ + required = false + /** 强调 */ + emphasize = false + /** 在发现文档显示 */ + showInDiscoveryDocument = false + /** 并发令牌 */ + concurrencyStamp = '' + /** 用户声明 */ + userClaims = new Array() + + /** 返回一个空对象 */ + public static empty() { + return new IdentityResourceUpdate() + } + + /** 创建身份资源 */ + public static create(identityResource: IdentityResource) { + let resource = new IdentityResourceUpdate() + resource.concurrencyStamp = identityResource.concurrencyStamp + resource.description = identityResource.description + resource.displayName = identityResource.displayName + resource.emphasize = identityResource.emphasize + resource.enabled = identityResource.enabled + resource.id = identityResource.id + resource.name = identityResource.name + resource.required = identityResource.required + resource.showInDiscoveryDocument = identityResource.showInDiscoveryDocument + resource.userClaims = identityResource.userClaims + return resource + } +} + +/** 身份资源对象 */ +export class IdentityResource extends FullAuditedEntityDto { + /** 身份资源标识 */ + id!: string + /** 名称 */ + name!: string + /** 显示名称 */ + displayName?: string + /** 说明 */ + description?: string + /** 并发令牌 */ + concurrencyStamp!: string + /** 启用 */ + enabled!: boolean + /** 必须 */ + required!: boolean + /** 强调 */ + emphasize!: boolean + /** 在发现文档显示 */ + showInDiscoveryDocument!: boolean + /** 用户声明 */ + userClaims!: IdentityClaim[] + /** 属性 */ + properties!: IdentityProperty[] + + /** 返回一个空对象 */ + public static empty() { + const resource = new IdentityResource() + resource.enabled = true + return resource + } +} diff --git a/vueJs/src/api/types.ts b/vueJs/src/api/types.ts index 8e637984b..912539229 100644 --- a/vueJs/src/api/types.ts +++ b/vueJs/src/api/types.ts @@ -52,6 +52,7 @@ export interface IPermission { isGranted: boolean } +/** 分页排序查询对象 */ export class PagedAndSortedResultRequestDto implements IPagedResultRequest, ISortedResultRequest { /** 查询页码 */ skipCount: number diff --git a/vueJs/src/lang/zh.ts b/vueJs/src/lang/zh.ts index cb447468f..3474d241d 100644 --- a/vueJs/src/lang/zh.ts +++ b/vueJs/src/lang/zh.ts @@ -74,7 +74,8 @@ export default { route: '路由配置', identityServer: '身份认证服务器', clients: '客户端管理', - apiresources: 'Api资源管理' + apiresources: 'Api资源管理', + identityresources: '身份资源管理' }, navbar: { logOut: '退出登录', @@ -397,10 +398,10 @@ export default { createClaimSuccess: '客户端声明: {type} 已添加!', createClaim: '添加客户端声明', deleteProperty: '删除属性', - deletePropertyByType: '是否要删除客户端属性: {key}', - deletePropertySuccess: '客户端属性: {key} 已删除!', - createPropertySuccess: '客户端属性: {key} 已添加!', - createProperty: '添加客户端属性', + deleteClientPropertyByType: '是否要删除客户端属性: {key}', + deleteClientPropertySuccess: '客户端属性: {key} 已删除!', + createClientPropertySuccess: '客户端属性: {key} 已添加!', + createClientProperty: '添加客户端属性', createClient: '添加客户端', clientId: '客户端标识', clientName: '客户端名称', @@ -413,7 +414,7 @@ export default { copyAllowedCorsOrigin: '复制客户端跨域来源', copyPostLogoutRedirectUri: '复制客户端注销重定向Uri', copyPropertie: '复制客户端属性', - copyIdentityProviderRestriction: '身份提供程序限制', + copyIdentityProviderRestriction: '复制身份提供程序限制', protocolType: '协议类型', requireClientSecret: '需要客户端密钥', requirePkce: '需要Pkce', @@ -483,17 +484,59 @@ export default { deleteApiScopeSuccess: 'Api作用域 {name} 已删除!', apiResourceScope: 'Api 作用域', deleteApiResource: '删除资源', - apiResourceName: '资源名称', - apiResourceDisplayName: '显示名称', - enabledApiResource: '启用资源', - apiResourceStatus: '资源状态', - apiResourceDescription: '资源说明', - apiResourceUserClaims: '用户声明', + resourceName: '资源名称', + resourceDisplayName: '显示名称', + enabledResource: '启用资源', + resourceStatus: '资源状态', + resourceDescription: '资源说明', + resourceUserClaims: '用户声明', apiScopeName: '名称', apiScopeDisplayName: '显示名称', apiScopeDescription: '描述', apiScopeRequired: '必须', apiScopeEmphasize: '强调', - apiScopeShowInDiscoveryDocument: '在发现文档显示' + apiScopeShowInDiscoveryDocument: '在发现文档显示', + createIdentityResource: '添加身份资源', + updateIdentityResource: '编辑身份资源', + identityResourceProperties: '资源属性', + deleteIdentityResource: '删除资源', + updateIdentityResourceByName: '编辑身份资源 {name}', + deleteIdentityResourceByName: '删除身份资源 {name}', + createIdentityResourceSuccess: '身份资源 {name} 已添加!', + deleteIdentityResourceSuccess: '身份资源 {name} 已删除!', + updateIdentityResourceSuccess: '身份资源 {name} 已修改!', + identityResourceRequired: '必须', + identityResourceEmphasize: '强调', + identityResourceShowInDiscoveryDocument: '在发现文档显示', + deleteIdentityPropertyByKey: '是否要删除身份资源属性: {key}', + deleteIdentityPropertySuccess: '身份资源属性: {key} 已删除!', + createIdentityPropertySuccess: '身份资源属性: {key} 已添加!', + createIdentityProperty: '添加身份资源属性' + }, + global: { + name: '名称', + displayName: '显示名称', + description: '说明', + operaActions: '操作方法', + queryFilter: '查询过滤', + filterString: '过滤字符', + searchList: '查询列表', + creationTime: '创建时间', + successful: '提交成功', + pleaseInputBy: '请输入{key}', + pleaseSelectBy: '请选择{key}', + none: '未定义', + questingDeleteByMessage: '是否要删除{message}?', + delNotRecoverData: '请注意,删除后不可恢复!', + whetherDeleteData: '是否删除选择的记录 {name} ?', + dataHasBeenDeleted: '选定的记录 {name} 已删除!', + fieldLengthMustBeRange: '字段的长度必须在{min}到{max}之间!', + enabled: '启用', + disbled: '停用', + status: '状态', + lastModificationTime: '修改时间', + otherOpera: '更多操作', + cancel: '取 消', + confirm: '确 定' } } diff --git a/vueJs/src/router/index.ts b/vueJs/src/router/index.ts index 40e2a8b42..916b00ea8 100644 --- a/vueJs/src/router/index.ts +++ b/vueJs/src/router/index.ts @@ -359,7 +359,7 @@ export const asyncRoutes: RouteConfig[] = [ meta: { title: 'identityServer', icon: 'manager', - roles: ['IdentityServer.Clients'], + roles: ['IdentityServer.Clients', 'IdentityServer.ApiResources', 'IdentityServer.IdentityResources'], alwaysShow: true }, children: [ @@ -382,6 +382,16 @@ export const asyncRoutes: RouteConfig[] = [ icon: 'apiresources', roles: ['IdentityServer.ApiResources'] } + }, + { + path: 'identityresources', + component: () => import('@/views/admin/identityServer/identity-resources/index.vue'), + name: 'identityresources', + meta: { + title: 'identityresources', + icon: 'identityresources', + roles: ['IdentityServer.IdentityResources'] + } } ] }, diff --git a/vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceCreateOrEditForm.vue b/vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceCreateOrEditForm.vue index e6f69ae80..8bc90eaac 100644 --- a/vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceCreateOrEditForm.vue +++ b/vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceCreateOrEditForm.vue @@ -9,7 +9,7 @@ > { this.apiResource = resource }) + } else { + this.apiResource = ApiResource.empty() } } diff --git a/vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceScopeEditForm.vue b/vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceScopeEditForm.vue index fe01859fe..bb259fe29 100644 --- a/vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceScopeEditForm.vue +++ b/vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceScopeEditForm.vue @@ -2,6 +2,7 @@
{{ $t('identityServer.createApiScope') }} +
- -
{{ $t('identityServer.createApiSecret') }} +
- - { this.client = client }) + } else { + this.client = Client.empty() } } @@ -615,11 +617,6 @@ export default class extends Vue { private l(name: string, values?: any[] | { [key: string]: any }) { return this.$t(name, values).toString() } - - private test(v: any) { - console.log(v) - console.log(this.client.redirectUris) - } } diff --git a/vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourceCreateOrEditForm.vue b/vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourceCreateOrEditForm.vue new file mode 100644 index 000000000..5c1c0eb85 --- /dev/null +++ b/vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourceCreateOrEditForm.vue @@ -0,0 +1,196 @@ + + + + + diff --git a/vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourcePropertyEditForm.vue b/vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourcePropertyEditForm.vue new file mode 100644 index 000000000..413902056 --- /dev/null +++ b/vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourcePropertyEditForm.vue @@ -0,0 +1,173 @@ + + + + + diff --git a/vueJs/src/views/admin/identityServer/identity-resources/index.vue b/vueJs/src/views/admin/identityServer/identity-resources/index.vue new file mode 100644 index 000000000..3a8c6f4d6 --- /dev/null +++ b/vueJs/src/views/admin/identityServer/identity-resources/index.vue @@ -0,0 +1,367 @@ + + + + + diff --git a/vueJs/src/views/admin/users/components/UserProfile.vue b/vueJs/src/views/admin/users/components/UserProfile.vue index 8278048b8..aaf4a97d3 100644 --- a/vueJs/src/views/admin/users/components/UserProfile.vue +++ b/vueJs/src/views/admin/users/components/UserProfile.vue @@ -4,8 +4,11 @@ label-width="80px" :model="userProfile" > - - + + - + - + () + const userProfileForm = this.$refs.profile as any userProfileForm.resetFields() + if (this.hasLoadPermission) { + const userPermission = this.$refs.permissionTree as PermissionTree + userPermission.resetPermissions() + this.hasLoadPermission = false + } } private createAddUserDto() { diff --git a/vueJs/src/views/admin/users/index.vue b/vueJs/src/views/admin/users/index.vue index 402ef52d5..59ace5415 100644 --- a/vueJs/src/views/admin/users/index.vue +++ b/vueJs/src/views/admin/users/index.vue @@ -107,6 +107,7 @@ :label="$t('users.operaActions')" align="center" width="250px" + min-width="250px" fixed="right" >