Browse Source

refactor the api Identity-Server

pull/109/head
cKey 5 years ago
parent
commit
09abcb6f3d
  1. 20
      aspnet-core/database/ApiGateway-Init-SqlServer.sql
  2. 70
      aspnet-core/database/ApiGateway-Init.sql
  3. 7
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceClaimDto.cs
  4. 20
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceCreateDto.cs
  5. 30
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceCreateOrUpdateDto.cs
  6. 4
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceDto.cs
  7. 9
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceGetByIdInputDto.cs
  8. 27
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceUpdateDto.cs
  9. 7
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiScopeClaimDto.cs
  10. 4
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiScopeCreateDto.cs
  11. 4
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiScopeDto.cs
  12. 16
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiScopeGetByNameInputDto.cs
  13. 33
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiSecretCreateDto.cs
  14. 7
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiSecretCreateOrUpdateDto.cs
  15. 21
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiSecretGetByTypeInputDto.cs
  16. 28
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/IApiResourceAppService.cs
  17. 20
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientClaimCreateDto.cs
  18. 20
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientClaimGetByKeyInputDto.cs
  19. 20
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientClaimUpdateDto.cs
  20. 12
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCloneInputDto.cs
  21. 23
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCreateDto.cs
  22. 27
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCreateOrUpdateDto.cs
  23. 28
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientDto.cs
  24. 11
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientGetByIdInputDto.cs
  25. 2
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientGetByPagedDto.cs
  26. 9
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientGrantTypeDto.cs
  27. 9
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientIdPRestrictionDto.cs
  28. 9
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientPostLogoutRedirectUriDto.cs
  29. 21
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientPropertyCreateDto.cs
  30. 11
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientPropertyDto.cs
  31. 21
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientPropertyGetByKeyDto.cs
  32. 21
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientPropertyUpdateDto.cs
  33. 9
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientRedirectUriDto.cs
  34. 9
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientScopeDto.cs
  35. 33
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientSecretCreateDto.cs
  36. 21
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientSecretGetByTypeDto.cs
  37. 28
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientSecretUpdateDto.cs
  38. 119
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientUpdateDto.cs
  39. 19
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientUpdateInputDto.cs
  40. 7
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/SecretCreateOrUpdateDto.cs
  41. 42
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/IClientAppService.cs
  42. 7
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityClaimDto.cs
  43. 12
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceCreateOrUpdateDto.cs
  44. 12
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceDto.cs
  45. 9
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByIdInputDto.cs
  46. 2
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByPagedDto.cs
  47. 23
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyCreateDto.cs
  48. 9
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyDto.cs
  49. 15
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyGetByKeyDto.cs
  50. 45
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceUpdateDto.cs
  51. 25
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/IIdentityResourceAppService.cs
  52. 25
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/en.json
  53. 26
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/zh-Hans.json
  54. 3
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/SecretBaseDto.cs
  55. 46
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs
  56. 152
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceAppService.cs
  57. 474
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/Clients/ClientAppService.cs
  58. 106
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceAppService.cs
  59. 58
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceController.cs
  60. 99
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/Clients/ClientController.cs
  61. 43
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceController.cs
  62. BIN
      aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db
  63. 105
      vueJs/src/api/api-resources.ts
  64. 279
      vueJs/src/api/apiresources.ts
  65. 39
      vueJs/src/api/identity-resources.ts
  66. 20
      vueJs/src/api/types.ts
  67. 201
      vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceCreateOrEditForm.vue
  68. 323
      vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceScopeEditForm.vue
  69. 172
      vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceSecretEditForm.vue
  70. 135
      vueJs/src/views/admin/identityServer/api-resources/index.vue
  71. 41
      vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourceCreateOrEditForm.vue
  72. 21
      vueJs/src/views/admin/identityServer/identity-resources/index.vue

20
aspnet-core/database/ApiGateway-Init-SqlServer.sql

File diff suppressed because one or more lines are too long

70
aspnet-core/database/ApiGateway-Init.sql

@ -1,5 +1,5 @@
/*
Navicat MySQL Data Transfer
Navicat Premium Data Transfer
Source Server :
Source Server Type : MySQL
@ -11,7 +11,7 @@
Target Server Version : 80020
File Encoding : 65001
Date: 15/10/2020 21:36:21
Date: 16/10/2020 21:00:34
*/
SET NAMES utf8mb4;
@ -90,7 +90,7 @@ CREATE TABLE `appapigatewayauthoptions` (
PRIMARY KEY (`Id`) USING BTREE,
UNIQUE INDEX `IX_AppApiGatewayAuthOptions_ReRouteId`(`ReRouteId`) USING BTREE,
CONSTRAINT `FK_AppApiGatewayAuthOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 136 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 137 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of appapigatewayauthoptions
@ -116,8 +116,6 @@ INSERT INTO `appapigatewayauthoptions` VALUES (22, 1262230734939758592, NULL, ''
INSERT INTO `appapigatewayauthoptions` VALUES (23, 1262296916350869504, NULL, '');
INSERT INTO `appapigatewayauthoptions` VALUES (24, 1262632376348594176, '', '');
INSERT INTO `appapigatewayauthoptions` VALUES (25, 1262632791869902848, '', '');
INSERT INTO `appapigatewayauthoptions` VALUES (26, 1262632904575045632, '', '');
INSERT INTO `appapigatewayauthoptions` VALUES (27, 1262632976616411136, '', '');
INSERT INTO `appapigatewayauthoptions` VALUES (28, 1262660336921235456, '', '');
INSERT INTO `appapigatewayauthoptions` VALUES (29, 1262660528277966848, '', '');
INSERT INTO `appapigatewayauthoptions` VALUES (30, 1262660706875625472, '', '');
@ -199,6 +197,7 @@ INSERT INTO `appapigatewayauthoptions` VALUES (132, 1316628769783480320, '', '')
INSERT INTO `appapigatewayauthoptions` VALUES (133, 1316628940663619584, '', '');
INSERT INTO `appapigatewayauthoptions` VALUES (134, 1316629112428756992, '', '');
INSERT INTO `appapigatewayauthoptions` VALUES (135, 1316652047017246720, '', '');
INSERT INTO `appapigatewayauthoptions` VALUES (136, 1316913899996737536, '', '');
-- ----------------------------
-- Table structure for appapigatewaybalanceroptions
@ -216,7 +215,7 @@ CREATE TABLE `appapigatewaybalanceroptions` (
UNIQUE INDEX `IX_AppApiGatewayBalancerOptions_ReRouteId`(`ReRouteId`) USING BTREE,
CONSTRAINT `FK_AppApiGatewayBalancerOptions_AppApiGatewayGlobalConfiguratio~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `FK_AppApiGatewayBalancerOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 139 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 140 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of appapigatewaybalanceroptions
@ -243,8 +242,6 @@ INSERT INTO `appapigatewaybalanceroptions` VALUES (23, NULL, 1262230734939758592
INSERT INTO `appapigatewaybalanceroptions` VALUES (24, NULL, 1262296916350869504, NULL, NULL, NULL);
INSERT INTO `appapigatewaybalanceroptions` VALUES (25, NULL, 1262632376348594176, '', '', 0);
INSERT INTO `appapigatewaybalanceroptions` VALUES (26, NULL, 1262632791869902848, '', '', 0);
INSERT INTO `appapigatewaybalanceroptions` VALUES (27, NULL, 1262632904575045632, '', '', 0);
INSERT INTO `appapigatewaybalanceroptions` VALUES (28, NULL, 1262632976616411136, '', '', 0);
INSERT INTO `appapigatewaybalanceroptions` VALUES (29, NULL, 1262660336921235456, '', '', 0);
INSERT INTO `appapigatewaybalanceroptions` VALUES (30, NULL, 1262660528277966848, '', '', 0);
INSERT INTO `appapigatewaybalanceroptions` VALUES (31, NULL, 1262660706875625472, '', '', 0);
@ -326,6 +323,7 @@ INSERT INTO `appapigatewaybalanceroptions` VALUES (135, NULL, 131662876978348032
INSERT INTO `appapigatewaybalanceroptions` VALUES (136, NULL, 1316628940663619584, '', '', 0);
INSERT INTO `appapigatewaybalanceroptions` VALUES (137, NULL, 1316629112428756992, '', '', 0);
INSERT INTO `appapigatewaybalanceroptions` VALUES (138, NULL, 1316652047017246720, '', '', 0);
INSERT INTO `appapigatewaybalanceroptions` VALUES (139, NULL, 1316913899996737536, '', '', 0);
-- ----------------------------
-- Table structure for appapigatewaycacheoptions
@ -339,7 +337,7 @@ CREATE TABLE `appapigatewaycacheoptions` (
PRIMARY KEY (`Id`) USING BTREE,
UNIQUE INDEX `IX_AppApiGatewayCacheOptions_ReRouteId`(`ReRouteId`) USING BTREE,
CONSTRAINT `FK_AppApiGatewayCacheOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 136 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 137 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of appapigatewaycacheoptions
@ -363,10 +361,8 @@ INSERT INTO `appapigatewaycacheoptions` VALUES (18, 1261606689601732608, NULL, N
INSERT INTO `appapigatewaycacheoptions` VALUES (21, 1262220447629058048, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (22, 1262230734939758592, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (23, 1262296916350869504, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (24, 1262632376348594176, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (24, 1262632376348594176, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (25, 1262632791869902848, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (26, 1262632904575045632, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (27, 1262632976616411136, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (28, 1262660336921235456, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (29, 1262660528277966848, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (30, 1262660706875625472, 0, '');
@ -386,8 +382,8 @@ INSERT INTO `appapigatewaycacheoptions` VALUES (43, 1262665456471920640, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (44, 1262665628165754880, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (45, 1262666172682883072, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (47, 1262723402331885568, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (48, 1262935771746734080, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (49, 1262935906522304512, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (48, 1262935771746734080, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (49, 1262935906522304512, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (50, 1262936009924481024, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (52, 1263074419073593344, NULL, NULL);
INSERT INTO `appapigatewaycacheoptions` VALUES (53, 1263075249394790400, 0, '');
@ -448,6 +444,7 @@ INSERT INTO `appapigatewaycacheoptions` VALUES (132, 1316628769783480320, 0, '')
INSERT INTO `appapigatewaycacheoptions` VALUES (133, 1316628940663619584, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (134, 1316629112428756992, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (135, 1316652047017246720, 0, '');
INSERT INTO `appapigatewaycacheoptions` VALUES (136, 1316913899996737536, 0, '');
-- ----------------------------
-- Table structure for appapigatewaydiscovery
@ -557,7 +554,7 @@ CREATE TABLE `appapigatewayhttpoptions` (
UNIQUE INDEX `IX_AppApiGatewayHttpOptions_ReRouteId`(`ReRouteId`) USING BTREE,
CONSTRAINT `FK_AppApiGatewayHttpOptions_AppApiGatewayGlobalConfiguration_It~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `FK_AppApiGatewayHttpOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 139 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 140 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of appapigatewayhttpoptions
@ -584,8 +581,6 @@ INSERT INTO `appapigatewayhttpoptions` VALUES (23, NULL, 1262230734939758592, NU
INSERT INTO `appapigatewayhttpoptions` VALUES (24, NULL, 1262296916350869504, NULL, 0, 0, 1, 0);
INSERT INTO `appapigatewayhttpoptions` VALUES (25, NULL, 1262632376348594176, 0, 0, 0, 0, 0);
INSERT INTO `appapigatewayhttpoptions` VALUES (26, NULL, 1262632791869902848, 0, 0, 0, 0, 0);
INSERT INTO `appapigatewayhttpoptions` VALUES (27, NULL, 1262632904575045632, 0, 0, 0, 0, 0);
INSERT INTO `appapigatewayhttpoptions` VALUES (28, NULL, 1262632976616411136, 0, 0, 0, 0, 0);
INSERT INTO `appapigatewayhttpoptions` VALUES (29, NULL, 1262660336921235456, 0, 0, 0, 0, 0);
INSERT INTO `appapigatewayhttpoptions` VALUES (30, NULL, 1262660528277966848, 0, 0, 0, 0, 0);
INSERT INTO `appapigatewayhttpoptions` VALUES (31, NULL, 1262660706875625472, 0, 0, 0, 0, 0);
@ -667,6 +662,7 @@ INSERT INTO `appapigatewayhttpoptions` VALUES (135, NULL, 1316628769783480320, 0
INSERT INTO `appapigatewayhttpoptions` VALUES (136, NULL, 1316628940663619584, 0, 0, 0, 0, 0);
INSERT INTO `appapigatewayhttpoptions` VALUES (137, NULL, 1316629112428756992, 0, 0, 0, 0, 0);
INSERT INTO `appapigatewayhttpoptions` VALUES (138, NULL, 1316652047017246720, 0, 0, 0, 0, 0);
INSERT INTO `appapigatewayhttpoptions` VALUES (139, NULL, 1316913899996737536, 0, 0, 0, 0, 0);
-- ----------------------------
-- Table structure for appapigatewayqosoptions
@ -684,7 +680,7 @@ CREATE TABLE `appapigatewayqosoptions` (
UNIQUE INDEX `IX_AppApiGatewayQoSOptions_ReRouteId`(`ReRouteId`) USING BTREE,
CONSTRAINT `FK_AppApiGatewayQoSOptions_AppApiGatewayGlobalConfiguration_Ite~` FOREIGN KEY (`ItemId`) REFERENCES `appapigatewayglobalconfiguration` (`ItemId`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `FK_AppApiGatewayQoSOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 139 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 140 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of appapigatewayqosoptions
@ -711,8 +707,6 @@ INSERT INTO `appapigatewayqosoptions` VALUES (23, NULL, 1262230734939758592, 60,
INSERT INTO `appapigatewayqosoptions` VALUES (24, NULL, 1262296916350869504, 60, 60000, 30000);
INSERT INTO `appapigatewayqosoptions` VALUES (25, NULL, 1262632376348594176, 50, 60000, 30000);
INSERT INTO `appapigatewayqosoptions` VALUES (26, NULL, 1262632791869902848, 50, 60000, 30000);
INSERT INTO `appapigatewayqosoptions` VALUES (27, NULL, 1262632904575045632, 50, 60000, 30000);
INSERT INTO `appapigatewayqosoptions` VALUES (28, NULL, 1262632976616411136, 50, 60000, 30000);
INSERT INTO `appapigatewayqosoptions` VALUES (29, NULL, 1262660336921235456, 50, 60000, 30000);
INSERT INTO `appapigatewayqosoptions` VALUES (30, NULL, 1262660528277966848, 50, 60000, 30000);
INSERT INTO `appapigatewayqosoptions` VALUES (31, NULL, 1262660706875625472, 50, 60000, 30000);
@ -794,6 +788,7 @@ INSERT INTO `appapigatewayqosoptions` VALUES (135, NULL, 1316628769783480320, 50
INSERT INTO `appapigatewayqosoptions` VALUES (136, NULL, 1316628940663619584, 50, 60000, 30000);
INSERT INTO `appapigatewayqosoptions` VALUES (137, NULL, 1316629112428756992, 50, 60000, 30000);
INSERT INTO `appapigatewayqosoptions` VALUES (138, NULL, 1316652047017246720, 50, 60000, 30000);
INSERT INTO `appapigatewayqosoptions` VALUES (139, NULL, 1316913899996737536, 50, 60000, 30000);
-- ----------------------------
-- Table structure for appapigatewayratelimitoptions
@ -835,7 +830,7 @@ CREATE TABLE `appapigatewayratelimitrule` (
UNIQUE INDEX `IX_AppApiGatewayRateLimitRule_ReRouteId`(`ReRouteId`) USING BTREE,
CONSTRAINT `FK_AppApiGatewayRateLimitRule_AppApiGatewayDynamicReRoute_Dynam~` FOREIGN KEY (`DynamicReRouteId`) REFERENCES `appapigatewaydynamicreroute` (`DynamicReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT,
CONSTRAINT `FK_AppApiGatewayRateLimitRule_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 136 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 137 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of appapigatewayratelimitrule
@ -861,8 +856,6 @@ INSERT INTO `appapigatewayratelimitrule` VALUES (22, 1262230734939758592, NULL,
INSERT INTO `appapigatewayratelimitrule` VALUES (23, 1262296916350869504, NULL, '', 0, NULL, NULL, NULL);
INSERT INTO `appapigatewayratelimitrule` VALUES (24, 1262632376348594176, NULL, '', 0, NULL, NULL, NULL);
INSERT INTO `appapigatewayratelimitrule` VALUES (25, 1262632791869902848, NULL, '', 0, NULL, NULL, NULL);
INSERT INTO `appapigatewayratelimitrule` VALUES (26, 1262632904575045632, NULL, '', 0, NULL, NULL, NULL);
INSERT INTO `appapigatewayratelimitrule` VALUES (27, 1262632976616411136, NULL, '', 0, NULL, NULL, NULL);
INSERT INTO `appapigatewayratelimitrule` VALUES (28, 1262660336921235456, NULL, '', 0, NULL, NULL, NULL);
INSERT INTO `appapigatewayratelimitrule` VALUES (29, 1262660528277966848, NULL, '', 0, NULL, NULL, NULL);
INSERT INTO `appapigatewayratelimitrule` VALUES (30, 1262660706875625472, NULL, '', 0, NULL, NULL, NULL);
@ -944,6 +937,7 @@ INSERT INTO `appapigatewayratelimitrule` VALUES (132, 1316628769783480320, NULL,
INSERT INTO `appapigatewayratelimitrule` VALUES (133, 1316628940663619584, NULL, '', 0, NULL, NULL, NULL);
INSERT INTO `appapigatewayratelimitrule` VALUES (134, 1316629112428756992, NULL, '', 0, NULL, NULL, NULL);
INSERT INTO `appapigatewayratelimitrule` VALUES (135, 1316652047017246720, NULL, '', 0, NULL, NULL, NULL);
INSERT INTO `appapigatewayratelimitrule` VALUES (136, 1316913899996737536, NULL, '', 0, NULL, NULL, NULL);
-- ----------------------------
-- Table structure for appapigatewayreroute
@ -983,7 +977,7 @@ CREATE TABLE `appapigatewayreroute` (
PRIMARY KEY (`Id`) USING BTREE,
UNIQUE INDEX `AK_AppApiGatewayReRoute_ReRouteId`(`ReRouteId`) USING BTREE,
UNIQUE INDEX `IX_AppApiGatewayReRoute_AppId_DownstreamPathTemplate_UpstreamPa~`(`AppId`, `DownstreamPathTemplate`, `UpstreamPathTemplate`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 143 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 144 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of appapigatewayreroute
@ -1007,10 +1001,8 @@ INSERT INTO `appapigatewayreroute` VALUES (19, '{}', 'd665e4491b81413385858601d9
INSERT INTO `appapigatewayreroute` VALUES (22, '{}', '47c55e759d824450a987a705fd08387c', 1262220447629058048, '【身份认证服务】- 客户端密钥', '/api/IdentityServer/Clients/Secrets', '', NULL, '/api/IdentityServer/Clients/Secrets', 'PUT,POST,DELETE,', '', '', '', '', '', '', NULL, 1, NULL, NULL, 'HTTP', '127.0.0.1:30015,', '', NULL, NULL, NULL, 30000, 1, NULL, 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (23, '{}', '4da82cbff6ab48e185100526eaed22df', 1262230734939758592, '【身份认证服务】- 客户端声明', '/api/IdentityServer/Clients/Claims', '', NULL, '/api/IdentityServer/Clients/Claims', 'PUT,POST,DELETE,', '', '', '', '', '', '', NULL, 1, NULL, NULL, 'HTTP', '127.0.0.1:30015,', '', NULL, NULL, NULL, 30000, 1, NULL, 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (25, '{}', 'b6009df9b18c44b3aa2b77f27b0c2abb', 1262296916350869504, '【身份认证服务】- 客户端属性', '/api/IdentityServer/Clients/Properties', '', NULL, '/api/IdentityServer/Clients/Properties', 'PUT,POST,DELETE,', '', '', '', '', '', '', NULL, 1, NULL, NULL, 'HTTP', '127.0.0.1:30015,', '', NULL, NULL, NULL, 30000, 1, NULL, 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (26, '{}', '401a7a8e8a2f41c599b1b87b55249a32', 1262632376348594176, '【身份认证服务】- Api资源管理', '/api/IdentityServer/ApiResources', '', '', '/api/IdentityServer/ApiResources', 'GET,POST,PUT,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (27, '{}', 'c662a4c29e654f9da6eb73ee456b533a', 1262632791869902848, '【身份认证服务】- 单个Api资源', '/api/IdentityServer/ApiResources/{Id}', '', '', '/api/IdentityServer/ApiResources/{Id}', 'GET,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (28, '{}', 'a0c2bdfdd0de4832b63d6dc3696c9c26', 1262632904575045632, '【身份认证服务】- Api资源密钥', '/api/IdentityServer/ApiResources/Secrets', '', '', '/api/IdentityServer/ApiResources/Secrets', 'DELETE,POST,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (29, '{}', 'fb0e7ca974f243ce9f4034b39bdda326', 1262632976616411136, '【身份认证服务】- Api资源作用域', '/api/IdentityServer/ApiResources/Scopes', '', '', '/api/IdentityServer/ApiResources/Scopes', 'DELETE,POST,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (26, '{}', '3fccd1318d0d47d9aef85542668829a6', 1262632376348594176, '【身份认证服务】- Api资源', '/api/identity-server/api-resources', '', '', '/api/identity-server/api-resources', 'GET,POST,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (27, '{}', 'de6bd0ddea6d4019b4855be5442fafdc', 1262632791869902848, '【身份认证服务】- 管理Api资源', '/api/identity-server/api-resources/{id}', '', '', '/api/identity-server/api-resources/{id}', 'GET,DELETE,PUT,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (30, '{}', '0f9875697b74420c9dc2eaf77099b210', 1262660336921235456, '【身份认证服务】- 用户登录', '/api/account/login', '', '', '/api/account/login', 'POST,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (31, '{}', 'a890c6ecc6a64c9fa313a0f6b5406e1c', 1262660528277966848, '【身份认证服务】- 用户登出', '/api/account/logout', '', '', '/api/account/logout', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (32, '{}', '88de580b6beb4d9d9d4367840ba1fcea', 1262660706875625472, '【身份认证服务】- 检查密码', '/api/account/checkPassword', '', '', '/api/account/checkPassword', 'POST,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
@ -1030,8 +1022,8 @@ INSERT INTO `appapigatewayreroute` VALUES (45, '{}', 'f5c0c8c02c0846fdbe5015cd86
INSERT INTO `appapigatewayreroute` VALUES (46, '{}', 'ecf0ea4a3e3c4b2e8fa3621514d00c74', 1262665628165754880, '【基础服务】- 通过名称查询租户', '/api/abp/multi-tenancy/tenants/by-name/{name}', '', '', '/api/abp/multi-tenancy/tenants/by-name/{name}', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30010,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (47, '{}', '69132bc515b64005af4292ce0dee5626', 1262666172682883072, '【基础服务】- 通过标识查询租户', '/api/abp/multi-tenancy/tenants/by-id/{id}', '', '', '/api/abp/multi-tenancy/tenants/by-id/{id}', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30010,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (49, '{}', '4114a097b9e04a9e90458edf02ef41c7', 1262723402331885568, '【身份认证服务】- 克隆客户端', '/api/IdentityServer/Clients/Clone', '', '', '/api/IdentityServer/Clients/Clone', 'POST,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (50, '{}', '2a9cc98d3ed0462d98c4bf0e946f410d', 1262935771746734080, '【身份认证服务】- 身份资源管理', '/api/IdentityServer/IdentityResources', '', '', '/api/IdentityServer/IdentityResources', 'GET,POST,PUT,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (51, '{}', '4d36b0ea5b92473ea5de3e91ff155830', 1262935906522304512, '【身份认证服务】- 查询身份资源', '/api/IdentityServer/IdentityResources/{Id}', '', '', '/api/IdentityServer/IdentityResources/{Id}', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (50, '{}', 'f333d028839d4fc2aafa8509e674d7dd', 1262935771746734080, '【身份认证服务】- 身份资源', '/api/identity-server/identity-resources', '', '', '/api/identity-server/identity-resources', 'GET,POST,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (51, '{}', 'dffd1bfaca5b4c1890221678f2b16cd5', 1262935906522304512, '【身份认证服务】- 身份资源管理', '/api/identity-server/identity-resources/{id}', '', '', '/api/identity-server/identity-resources/{id}', 'GET,PUT,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (52, '{}', '387df08693e54e91ac055a2324d4c10e', 1262936009924481024, '【身份认证服务】- 身份资源属性', '/api/IdentityServer/IdentityResources/Properties', '', '', '/api/IdentityServer/IdentityResources/Properties', 'POST,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (54, '{}', '7b847d8434bc4d1db07fa8961d90c14a', 1263074419073593344, '【服务网关管理】- 接口代理', '/api/abp/api-definition', '', '', '/api/abp/apigateway/api-definition', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30001,', '', '', 'apigateway-api-definition', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (55, '{}', 'ca2cedfa620045a9adef0be2f958c4bc', 1263075249394790400, '【服务网关管理】- 查询聚合路由', '/api/ApiGateway/Aggregates/{RouteId}', '', '', '/api/ApiGateway/Aggregates/{RouteId}', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30001,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
@ -1092,6 +1084,7 @@ INSERT INTO `appapigatewayreroute` VALUES (139, '{}', '0379fcb3a9cd4b13b562b3b5b
INSERT INTO `appapigatewayreroute` VALUES (140, '{}', 'de25c9a80d994f728b37eb483b2f5127', 1316628940663619584, '【身份认证服务】- 管理声明类型', '/api/identity/claim-types/{id}', '', '', '/api/identity/claim-types/{id}', 'GET,PUT,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (141, '{}', '25c19106baff4cf3a877ae8cd690a1b5', 1316629112428756992, '【身份认证服务】- 查询在用的声明类型列表', '/api/identity/claim-types/actived-list', '', '', '/api/identity/claim-types/actived-list', 'GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (142, '{}', 'd42f8b779cf344eeaa24df0ae37fb7cf', 1316652047017246720, '【身份认证服务】- 管理用户声明', '/api/identity/users/claims/{id}', '', '', '/api/identity/users/claims/{id}', 'POST,PUT,DELETE,GET,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
INSERT INTO `appapigatewayreroute` VALUES (143, '{}', 'b86af44a34a14db4b482df8550f1bde1', 1316913899996737536, '【身份认证管理】- 管理角色声明', '/api/identity/roles/claims/{id}', '', '', '/api/identity/roles/claims/{id}', 'GET,POST,PUT,DELETE,', '', '', '', '', '', '', '', 1, '', '', 'HTTP', '127.0.0.1:30015,', '', '', '', 0, 30000, 1, '', 'TEST-APP');
-- ----------------------------
-- Table structure for appapigatewayroutegroup
@ -1135,7 +1128,7 @@ CREATE TABLE `appapigatewaysecurityoptions` (
PRIMARY KEY (`Id`) USING BTREE,
UNIQUE INDEX `IX_AppApiGatewaySecurityOptions_ReRouteId`(`ReRouteId`) USING BTREE,
CONSTRAINT `FK_AppApiGatewaySecurityOptions_AppApiGatewayReRoute_ReRouteId` FOREIGN KEY (`ReRouteId`) REFERENCES `appapigatewayreroute` (`ReRouteId`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 136 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
) ENGINE = InnoDB AUTO_INCREMENT = 137 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of appapigatewaysecurityoptions
@ -1161,8 +1154,6 @@ INSERT INTO `appapigatewaysecurityoptions` VALUES (22, 1262230734939758592, '',
INSERT INTO `appapigatewaysecurityoptions` VALUES (23, 1262296916350869504, '', '');
INSERT INTO `appapigatewaysecurityoptions` VALUES (24, 1262632376348594176, '', '');
INSERT INTO `appapigatewaysecurityoptions` VALUES (25, 1262632791869902848, '', '');
INSERT INTO `appapigatewaysecurityoptions` VALUES (26, 1262632904575045632, '', '');
INSERT INTO `appapigatewaysecurityoptions` VALUES (27, 1262632976616411136, '', '');
INSERT INTO `appapigatewaysecurityoptions` VALUES (28, 1262660336921235456, '', '');
INSERT INTO `appapigatewaysecurityoptions` VALUES (29, 1262660528277966848, '', '');
INSERT INTO `appapigatewaysecurityoptions` VALUES (30, 1262660706875625472, '', '');
@ -1244,6 +1235,7 @@ INSERT INTO `appapigatewaysecurityoptions` VALUES (132, 1316628769783480320, '',
INSERT INTO `appapigatewaysecurityoptions` VALUES (133, 1316628940663619584, '', '');
INSERT INTO `appapigatewaysecurityoptions` VALUES (134, 1316629112428756992, '', '');
INSERT INTO `appapigatewaysecurityoptions` VALUES (135, 1316652047017246720, '', '');
INSERT INTO `appapigatewaysecurityoptions` VALUES (136, 1316913899996737536, '', '');
-- ----------------------------
-- Table structure for cap.published
@ -1265,10 +1257,14 @@ CREATE TABLE `cap.published` (
-- ----------------------------
-- Records of cap.published
-- ----------------------------
INSERT INTO `cap.published` VALUES (1316628771217932288, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1316628771217932288\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/15 14:35:35 +08:00\",\"cap-corr-id\":\"1316628771217932288\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-15T14:35:35.4925577+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-15 14:35:36', '2020-10-16 14:35:36', 'Succeeded');
INSERT INTO `cap.published` VALUES (1316628940789448704, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1316628940789448704\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/15 14:36:15 +08:00\",\"cap-corr-id\":\"1316628940789448704\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-15T14:36:15.9244062+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-15 14:36:16', '2020-10-16 14:36:16', 'Succeeded');
INSERT INTO `cap.published` VALUES (1316629112500060160, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1316629112500060160\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/15 14:36:56 +08:00\",\"cap-corr-id\":\"1316629112500060160\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-15T14:36:56.8629946+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-15 14:36:57', '2020-10-16 14:36:57', 'Succeeded');
INSERT INTO `cap.published` VALUES (1316652047117910016, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1316652047117910016\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/15 16:08:04 +08:00\",\"cap-corr-id\":\"1316652047117910016\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-15T16:08:04.901902+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-15 16:08:05', '2020-10-16 16:08:05', 'Succeeded');
INSERT INTO `cap.published` VALUES (1316913901179531264, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1316913901179531264\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/16 9:28:35 +08:00\",\"cap-corr-id\":\"1316913901179531264\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-16T09:28:35.7734416+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Create\",\"Object\":\"ReRoute\"}}', 0, '2020-10-16 09:28:36', '2020-10-17 09:28:36', 'Succeeded');
INSERT INTO `cap.published` VALUES (1317010396352376832, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1317010396352376832\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/16 15:52:02 +08:00\",\"cap-corr-id\":\"1317010396352376832\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-16T15:52:02.0169083+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-16 15:52:02', '2020-10-17 15:52:02', 'Succeeded');
INSERT INTO `cap.published` VALUES (1317010428531077120, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1317010428531077120\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/16 15:52:09 +08:00\",\"cap-corr-id\":\"1317010428531077120\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-16T15:52:09.6896583+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-16 15:52:10', '2020-10-17 15:52:10', 'Succeeded');
INSERT INTO `cap.published` VALUES (1317010521804009472, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1317010521804009472\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/16 15:52:31 +08:00\",\"cap-corr-id\":\"1317010521804009472\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-16T15:52:31.9268977+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-16 15:52:32', '2020-10-17 15:52:32', 'Succeeded');
INSERT INTO `cap.published` VALUES (1317010532486901760, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1317010532486901760\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/16 15:52:34 +08:00\",\"cap-corr-id\":\"1317010532486901760\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-16T15:52:34.474519+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Delete\",\"Object\":\"ReRoute\"}}', 0, '2020-10-16 15:52:34', '2020-10-17 15:52:34', 'Succeeded');
INSERT INTO `cap.published` VALUES (1317010545040453632, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1317010545040453632\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/16 15:52:37 +08:00\",\"cap-corr-id\":\"1317010545040453632\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-16T15:52:37.4659098+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Delete\",\"Object\":\"ReRoute\"}}', 0, '2020-10-16 15:52:37', '2020-10-17 15:52:37', 'Succeeded');
INSERT INTO `cap.published` VALUES (1317073463182389248, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1317073463182389248\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/16 20:02:38 +08:00\",\"cap-corr-id\":\"1317073463182389248\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-16T20:02:38.320969+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-16 20:02:38', '2020-10-17 20:02:38', 'Succeeded');
INSERT INTO `cap.published` VALUES (1317073573329006592, 'v1', 'LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData', '{\"Headers\":{\"cap-callback-name\":null,\"cap-msg-id\":\"1317073573329006592\",\"cap-msg-name\":\"LINGYUN.ApiGateway.EventBus.ApigatewayConfigChangeEventData\",\"cap-msg-type\":\"Object\",\"cap-senttime\":\"2020/10/16 20:03:04 +08:00\",\"cap-corr-id\":\"1317073573329006592\",\"cap-corr-seq\":\"0\"},\"Value\":{\"DateTime\":\"2020-10-16T20:03:04.5820788+08:00\",\"AppId\":\"TEST-APP\",\"Method\":\"Modify\",\"Object\":\"ReRoute\"}}', 0, '2020-10-16 20:03:05', '2020-10-17 20:03:05', 'Succeeded');
-- ----------------------------
-- Table structure for cap.received

7
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceClaimDto.cs

@ -1,7 +0,0 @@
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public class ApiResourceClaimDto
{
public string Type { get; set; }
}
}

20
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceCreateDto.cs

@ -1,28 +1,12 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.ApiResources;
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public class ApiResourceCreateDto
public class ApiResourceCreateDto : ApiResourceCreateOrUpdateDto
{
[Required]
[StringLength(ApiResourceConsts.NameMaxLength)]
public string Name { get; set; }
[StringLength(ApiResourceConsts.DisplayNameMaxLength)]
public string DisplayName { get; set; }
[StringLength(ApiResourceConsts.DescriptionMaxLength)]
public string Description { get; set; }
public bool Enabled { get; set; }
public List<ApiResourceClaimDto> UserClaims { get; set; }
public ApiResourceCreateDto()
{
Enabled = true;
UserClaims = new List<ApiResourceClaimDto>();
}
}
}

30
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceCreateOrUpdateDto.cs

@ -0,0 +1,30 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.ApiResources;
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public class ApiResourceCreateOrUpdateDto
{
[StringLength(ApiResourceConsts.DisplayNameMaxLength)]
public string DisplayName { get; set; }
[StringLength(ApiResourceConsts.DescriptionMaxLength)]
public string Description { get; set; }
public bool Enabled { get; set; }
public List<string> UserClaims { get; set; }
public List<ApiScopeDto> Scopes { get; set; }
public List<ApiSecretCreateOrUpdateDto> Secrets { get; set; }
protected ApiResourceCreateOrUpdateDto()
{
UserClaims = new List<string>();
Scopes = new List<ApiScopeDto>();
Secrets = new List<ApiSecretCreateOrUpdateDto>();
}
}
}

4
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceDto.cs

@ -18,13 +18,13 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources
public List<ApiScopeDto> Scopes { get; set; }
public List<ApiResourceClaimDto> UserClaims { get; set; }
public List<string> UserClaims { get; set; }
public ApiResourceDto()
{
UserClaims = new List<string>();
Scopes = new List<ApiScopeDto>();
Secrets = new List<ApiSecretDto>();
UserClaims = new List<ApiResourceClaimDto>();
}
}
}

9
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceGetByIdInputDto.cs

@ -1,9 +0,0 @@
using System;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public class ApiResourceGetByIdInputDto : EntityDto<Guid>
{
}
}

27
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiResourceUpdateDto.cs

@ -1,29 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
using Volo.Abp.IdentityServer.ApiResources;
namespace LINGYUN.Abp.IdentityServer.ApiResources
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public class ApiResourceUpdateDto
public class ApiResourceUpdateDto : ApiResourceCreateOrUpdateDto
{
[Required]
public Guid Id { get; set; }
[StringLength(ApiResourceConsts.DisplayNameMaxLength)]
public string DisplayName { get; set; }
[StringLength(ApiResourceConsts.DescriptionMaxLength)]
public string Description { get; set; }
public bool Enabled { get; set; }
public List<ApiResourceClaimDto> UserClaims { get; set; }
public ApiResourceUpdateDto()
{
UserClaims = new List<ApiResourceClaimDto>();
}
}
}

7
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiScopeClaimDto.cs

@ -1,7 +0,0 @@
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public class ApiScopeClaimDto
{
public string Type { get; set; }
}
}

4
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiScopeCreateDto.cs

@ -26,11 +26,11 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources
public bool ShowInDiscoveryDocument { get; set; }
public List<ApiScopeClaimDto> UserClaims { get; set; }
public List<string> UserClaims { get; set; }
public ApiScopeCreateDto()
{
UserClaims = new List<ApiScopeClaimDto>();
UserClaims = new List<string>();
}
}
}

4
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiScopeDto.cs

@ -16,11 +16,11 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources
public bool ShowInDiscoveryDocument { get; set; }
public List<ApiScopeClaimDto> UserClaims { get; set; }
public List<string> UserClaims { get; set; }
public ApiScopeDto()
{
UserClaims = new List<ApiScopeClaimDto>();
UserClaims = new List<string>();
}
}
}

16
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiScopeGetByNameInputDto.cs

@ -1,16 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.ApiResources;
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public class ApiScopeGetByNameInputDto
{
[Required]
public Guid ApiResourceId { get; set; }
[Required]
[StringLength(ApiScopeConsts.NameMaxLength)]
public string Name { get; set; }
}
}

33
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiSecretCreateDto.cs

@ -1,33 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public class ApiSecretCreateDto
{
[Required]
public Guid ApiResourceId { get; set; }
[Required]
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.TypeMaxLength))]
public string Type { get; set; }
public HashType HashType { get; set; }
[Required]
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.ValueMaxLength))]
public string Value { get; set; }
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.DescriptionMaxLength))]
public string Description { get; set; }
public DateTime? Expiration { get; set; }
public ApiSecretCreateDto()
{
HashType = 0;
}
}
}

7
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiSecretCreateOrUpdateDto.cs

@ -0,0 +1,7 @@
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public class ApiSecretCreateOrUpdateDto : SecretBaseDto
{
public HashType HashType { get; set; }
}
}

21
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/Dto/ApiSecretGetByTypeInputDto.cs

@ -1,21 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public class ApiSecretGetByTypeInputDto
{
[Required]
public Guid ApiResourceId { get; set; }
[Required]
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.TypeMaxLength))]
public string Type { get; set; }
[Required]
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.ValueMaxLength))]
public string Value { get; set; }
}
}

28
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/ApiResources/IApiResourceAppService.cs

@ -1,27 +1,15 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using System;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
public interface IApiResourceAppService : IApplicationService
public interface IApiResourceAppService :
ICrudAppService<
ApiResourceDto,
Guid,
ApiResourceGetByPagedInputDto,
ApiResourceCreateDto,
ApiResourceUpdateDto>
{
Task<ApiResourceDto> GetAsync(ApiResourceGetByIdInputDto apiResourceGetById);
Task<PagedResultDto<ApiResourceDto>> GetAsync(ApiResourceGetByPagedInputDto apiResourceGetByPaged);
Task<ApiResourceDto> CreateAsync(ApiResourceCreateDto apiResourceCreate);
Task<ApiResourceDto> UpdateAsync(ApiResourceUpdateDto apiResourceUpdate);
Task DeleteAsync(ApiResourceGetByIdInputDto apiResourceGetById);
Task<ApiSecretDto> AddSecretAsync(ApiSecretCreateDto apiSecretCreate);
Task DeleteSecretAsync(ApiSecretGetByTypeInputDto apiSecretGetByType);
Task<ApiScopeDto> AddScopeAsync(ApiScopeCreateDto apiScopeCreate);
Task DeleteScopeAsync(ApiScopeGetByNameInputDto apiScopeGetByName);
}
}

20
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientClaimCreateDto.cs

@ -1,20 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.Clients;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientClaimCreateDto
{
[Required]
public Guid ClientId { get; set; }
[Required]
[StringLength(ClientClaimConsts.TypeMaxLength)]
public string Type { get; set; }
[Required]
[StringLength(ClientClaimConsts.ValueMaxLength)]
public string Value { get; set; }
}
}

20
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientClaimGetByKeyInputDto.cs

@ -1,20 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.Clients;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientClaimGetByKeyInputDto
{
[Required]
public Guid ClientId { get; set; }
[Required]
[StringLength(ClientClaimConsts.TypeMaxLength)]
public string Type { get; set; }
[Required]
[StringLength(ClientClaimConsts.ValueMaxLength)]
public string Value { get; set; }
}
}

20
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientClaimUpdateDto.cs

@ -1,20 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.Clients;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientClaimUpdateDto
{
[Required]
public Guid ClientId { get; set; }
[Required]
[StringLength(ClientClaimConsts.TypeMaxLength)]
public string Type { get; set; }
[Required]
[StringLength(ClientClaimConsts.ValueMaxLength)]
public string Value { get; set; }
}
}

12
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCloneInputDto.cs

@ -1,16 +1,10 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.Clients;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientCloneInputDto
public class ClientCloneDto
{
/// <summary>
/// 来源客户端标识
/// </summary>
[Required]
public Guid SourceClientId { get; set; }
/// <summary>
/// 客户端标识
/// </summary>
@ -60,7 +54,7 @@ namespace LINGYUN.Abp.IdentityServer.Clients
/// 复制客户端 IdP 限制
/// </summary>
public bool CopyIdentityProviderRestriction { get; set; }
public ClientCloneInputDto()
public ClientCloneDto()
{
CopyAllowedCorsOrigin = true;
CopyAllowedGrantType = true;

23
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCreateDto.cs

@ -1,26 +1,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.Clients;
namespace LINGYUN.Abp.IdentityServer.Clients
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientCreateDto
public class ClientCreateDto : ClientCreateOrUpdateDto
{
[Required]
[StringLength(ClientConsts.ClientIdMaxLength)]
public string ClientId { get; set; }
[Required]
[StringLength(ClientConsts.ClientNameMaxLength)]
public string ClientName { get; set; }
[StringLength(ClientConsts.DescriptionMaxLength)]
public string Description { get; set; }
public List<ClientGrantTypeDto> AllowedGrantTypes { get; set; }
public ClientCreateDto()
{
AllowedGrantTypes = new List<ClientGrantTypeDto>();
}
}
}

27
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientCreateOrUpdateDto.cs

@ -0,0 +1,27 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.Clients;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientCreateOrUpdateDto
{
[Required]
[StringLength(ClientConsts.ClientIdMaxLength)]
public string ClientId { get; set; }
[Required]
[StringLength(ClientConsts.ClientNameMaxLength)]
public string ClientName { get; set; }
[StringLength(ClientConsts.DescriptionMaxLength)]
public string Description { get; set; }
public List<string> AllowedGrantTypes { get; set; }
protected ClientCreateOrUpdateDto()
{
AllowedGrantTypes = new List<string>();
}
}
}

28
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientDto.cs

@ -82,34 +82,34 @@ namespace LINGYUN.Abp.IdentityServer.Clients
public string ConcurrencyStamp { get; set; }
public List<ClientScopeDto> AllowedScopes { get; set; }
public List<string> AllowedScopes { get; set; }
public List<ClientSecretDto> ClientSecrets { get; set; }
public List<ClientGrantTypeDto> AllowedGrantTypes { get; set; }
public List<string> AllowedGrantTypes { get; set; }
public List<ClientCorsOriginDto> AllowedCorsOrigins { get; set; }
public List<string> AllowedCorsOrigins { get; set; }
public List<ClientRedirectUriDto> RedirectUris { get; set; }
public List<string> RedirectUris { get; set; }
public List<ClientPostLogoutRedirectUriDto> PostLogoutRedirectUris { get; set; }
public List<string> PostLogoutRedirectUris { get; set; }
public List<ClientIdPRestrictionDto> IdentityProviderRestrictions { get; set; }
public List<string> IdentityProviderRestrictions { get; set; }
public List<ClientClaimDto> Claims { get; set; }
public List<ClientPropertyDto> Properties { get; set; }
public Dictionary<string, string> Properties { get; set; }
public ClientDto()
{
Claims = new List<ClientClaimDto>();
Properties = new List<ClientPropertyDto>();
AllowedScopes = new List<ClientScopeDto>();
Properties = new Dictionary<string, string>();
AllowedScopes = new List<string>();
ClientSecrets = new List<ClientSecretDto>();
RedirectUris = new List<ClientRedirectUriDto>();
AllowedGrantTypes = new List<ClientGrantTypeDto>();
AllowedCorsOrigins = new List<ClientCorsOriginDto>();
PostLogoutRedirectUris = new List<ClientPostLogoutRedirectUriDto>();
IdentityProviderRestrictions = new List<ClientIdPRestrictionDto>();
RedirectUris = new List<string>();
AllowedGrantTypes = new List<string>();
AllowedCorsOrigins = new List<string>();
PostLogoutRedirectUris = new List<string>();
IdentityProviderRestrictions = new List<string>();
}
}
}

11
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientGetByIdInputDto.cs

@ -1,11 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientGetByIdInputDto
{
[Required]
public Guid Id { get; set; }
}
}

2
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientGetByPagedInputDto.cs → aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientGetByPagedDto.cs

@ -2,7 +2,7 @@
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientGetByPagedInputDto : PagedAndSortedResultRequestDto
public class ClientGetByPagedDto : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
}

9
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientGrantTypeDto.cs

@ -1,9 +0,0 @@
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientGrantTypeDto : EntityDto
{
public string GrantType { get; set; }
}
}

9
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientIdPRestrictionDto.cs

@ -1,9 +0,0 @@
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientIdPRestrictionDto : EntityDto
{
public string Provider { get; set; }
}
}

9
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientPostLogoutRedirectUriDto.cs

@ -1,9 +0,0 @@
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientPostLogoutRedirectUriDto : EntityDto
{
public string PostLogoutRedirectUri { get; set; }
}
}

21
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientPropertyCreateDto.cs

@ -1,21 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientPropertyCreateDto
{
[Required]
public Guid ClientId { get; set; }
[Required]
[DynamicStringLength(typeof(ClientPropertyConsts), nameof(ClientPropertyConsts.KeyMaxLength))]
public string Key { get; set; }
[Required]
[DynamicStringLength(typeof(ClientPropertyConsts), nameof(ClientPropertyConsts.ValueMaxLength))]
public string Value { get; set; }
}
}

11
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientPropertyDto.cs

@ -1,11 +0,0 @@
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientPropertyDto : EntityDto
{
public string Key { get; set; }
public string Value { get; set; }
}
}

21
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientPropertyGetByKeyDto.cs

@ -1,21 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientPropertyGetByKeyDto
{
[Required]
public Guid ClientId { get; set; }
[Required]
[DynamicStringLength(typeof(ClientPropertyConsts), nameof(ClientPropertyConsts.KeyMaxLength))]
public string Key { get; set; }
[Required]
[DynamicStringLength(typeof(ClientPropertyConsts), nameof(ClientPropertyConsts.ValueMaxLength))]
public string Value { get; set; }
}
}

21
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientPropertyUpdateDto.cs

@ -1,21 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientPropertyUpdateDto
{
[Required]
public Guid ClientId { get; set; }
[Required]
[DynamicStringLength(typeof(ClientPropertyConsts), nameof(ClientPropertyConsts.KeyMaxLength))]
public string Key { get; set; }
[Required]
[DynamicStringLength(typeof(ClientPropertyConsts), nameof(ClientPropertyConsts.ValueMaxLength))]
public string Value { get; set; }
}
}

9
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientRedirectUriDto.cs

@ -1,9 +0,0 @@
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientRedirectUriDto : EntityDto
{
public string RedirectUri { get; set; }
}
}

9
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientScopeDto.cs

@ -1,9 +0,0 @@
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientScopeDto : EntityDto
{
public string Scope { get; set; }
}
}

33
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientSecretCreateDto.cs

@ -1,33 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientSecretCreateDto
{
[Required]
public Guid ClientId { get; set; }
[Required]
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.TypeMaxLength))]
public string Type { get; set; }
public HashType HashType { get; set; }
[Required]
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.ValueMaxLength))]
public string Value { get; set; }
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.DescriptionMaxLength))]
public string Description { get; set; }
public DateTime? Expiration { get; set; }
public ClientSecretCreateDto()
{
HashType = 0;
}
}
}

21
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientSecretGetByTypeDto.cs

@ -1,21 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientSecretGetByTypeDto
{
[Required]
public Guid ClientId { get; set; }
[Required]
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.TypeMaxLength))]
public string Type { get; set; }
[Required]
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.ValueMaxLength))]
public string Value { get; set; }
}
}

28
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientSecretUpdateDto.cs

@ -1,28 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientSecretUpdateDto
{
[Required]
public Guid ClientId { get; set; }
[Required]
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.TypeMaxLength))]
public string Type { get; set; }
public HashType HashType { get; set; }
[Required]
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.ValueMaxLength))]
public string Value { get; set; }
[DynamicStringLength(typeof(SecretConsts), nameof(SecretConsts.DescriptionMaxLength))]
public string Description { get; set; }
public DateTime? Expiration { get; set; }
}
}

119
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientUpdateDto.cs

@ -4,20 +4,8 @@ using Volo.Abp.IdentityServer.Clients;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientUpdateDto
public class ClientUpdateDto : ClientCreateOrUpdateDto
{
[Required]
[StringLength(1000)]
public string ConcurrencyStamp { get; set; }
[StringLength(ClientConsts.ClientIdMaxLength)]
public string ClientId { get; set; }
[StringLength(ClientConsts.ClientNameMaxLength)]
public string ClientName { get; set; }
[StringLength(ClientConsts.DescriptionMaxLength)]
public string Description { get; set; }
[StringLength(ClientConsts.ClientUriMaxLength)]
public string ClientUri { get; set; }
@ -25,62 +13,62 @@ namespace LINGYUN.Abp.IdentityServer.Clients
[StringLength(ClientConsts.LogoUriMaxLength)]
public string LogoUri { get; set; }
public bool? Enabled { get; set; }
public bool Enabled { get; set; }
[StringLength(ClientConsts.ProtocolTypeMaxLength)]
public string ProtocolType { get; set; }
public bool? RequireClientSecret { get; set; }
public bool RequireClientSecret { get; set; }
public bool? RequireConsent { get; set; }
public bool RequireConsent { get; set; }
public bool? AllowRememberConsent { get; set; }
public bool AllowRememberConsent { get; set; }
public bool? AlwaysIncludeUserClaimsInIdToken { get; set; }
public bool AlwaysIncludeUserClaimsInIdToken { get; set; }
public bool? RequirePkce { get; set; }
public bool RequirePkce { get; set; }
public bool? AllowPlainTextPkce { get; set; }
public bool AllowPlainTextPkce { get; set; }
public bool? AllowAccessTokensViaBrowser { get; set; }
public bool AllowAccessTokensViaBrowser { get; set; }
[StringLength(ClientConsts.FrontChannelLogoutUriMaxLength)]
public string FrontChannelLogoutUri { get; set; }
public bool? FrontChannelLogoutSessionRequired { get; set; }
public bool FrontChannelLogoutSessionRequired { get; set; }
[StringLength(ClientConsts.BackChannelLogoutUriMaxLength)]
public string BackChannelLogoutUri { get; set; }
public bool? BackChannelLogoutSessionRequired { get; set; }
public bool BackChannelLogoutSessionRequired { get; set; }
public bool? AllowOfflineAccess { get; set; }
public bool AllowOfflineAccess { get; set; }
public int? IdentityTokenLifetime { get; set; }
public int IdentityTokenLifetime { get; set; }
public int? AccessTokenLifetime { get; set; }
public int AccessTokenLifetime { get; set; }
public int? AuthorizationCodeLifetime { get; set; }
public int AuthorizationCodeLifetime { get; set; }
public int? ConsentLifetime { get; set; }
public int? AbsoluteRefreshTokenLifetime { get; set; }
public int AbsoluteRefreshTokenLifetime { get; set; }
public int? SlidingRefreshTokenLifetime { get; set; }
public int SlidingRefreshTokenLifetime { get; set; }
public int? RefreshTokenUsage { get; set; }
public int RefreshTokenUsage { get; set; }
public bool? UpdateAccessTokenClaimsOnRefresh { get; set; }
public bool UpdateAccessTokenClaimsOnRefresh { get; set; }
public int? RefreshTokenExpiration { get; set; }
public int RefreshTokenExpiration { get; set; }
public int? AccessTokenType { get; set; }
public int AccessTokenType { get; set; }
public bool? EnableLocalLogin { get; set; }
public bool EnableLocalLogin { get; set; }
public bool? IncludeJwtId { get; set; }
public bool IncludeJwtId { get; set; }
public bool? AlwaysSendClientClaims { get; set; }
public bool AlwaysSendClientClaims { get; set; }
[StringLength(ClientConsts.ClientClaimsPrefixMaxLength)]
public string ClientClaimsPrefix { get; set; }
@ -93,29 +81,52 @@ namespace LINGYUN.Abp.IdentityServer.Clients
[StringLength(ClientConsts.UserCodeTypeMaxLength)]
public string UserCodeType { get; set; }
public int? DeviceCodeLifetime { get; set; }
public List<ClientScopeDto> AllowedScopes { get; set; }
public List<ClientGrantTypeDto> AllowedGrantTypes { get; set; }
public List<ClientCorsOriginDto> AllowedCorsOrigins { get; set; }
public List<ClientRedirectUriDto> RedirectUris { get; set; }
public List<ClientPostLogoutRedirectUriDto> PostLogoutRedirectUris { get; set; }
public int DeviceCodeLifetime { get; set; }
/// <summary>
/// Api资源(AllowScopes)
/// </summary>
public List<string> ApiResources { get; set; }
/// <summary>
/// 身份资源(AllowScopes)
/// </summary>
public List<string> IdentityResources { get; set; }
/// <summary>
/// 允许同源
/// </summary>
public List<string> AllowedCorsOrigins { get; set; }
/// <summary>
/// 重定向uri
/// </summary>
public List<string> RedirectUris { get; set; }
/// <summary>
/// 登出重定向uri
/// </summary>
public List<string> PostLogoutRedirectUris { get; set; }
/// <summary>
/// 限制提供商
/// </summary>
public List<string> IdentityProviderRestrictions { get; set; }
/// <summary>
/// 属性
/// </summary>
public Dictionary<string, string> Properties { get; set; }
/// <summary>
/// 密钥
/// </summary>
public List<SecretCreateOrUpdateDto> Secrets { get; set; }
public List<ClientIdPRestrictionDto> IdentityProviderRestrictions { get; set; }
public ClientUpdateDto()
{
Enabled = true;
DeviceCodeLifetime = 300;
AllowedScopes = new List<ClientScopeDto>();
RedirectUris = new List<ClientRedirectUriDto>();
AllowedGrantTypes = new List<ClientGrantTypeDto>();
AllowedCorsOrigins = new List<ClientCorsOriginDto>();
PostLogoutRedirectUris = new List<ClientPostLogoutRedirectUriDto>();
IdentityProviderRestrictions = new List<ClientIdPRestrictionDto>();
ApiResources = new List<string>();
IdentityResources = new List<string>();
RedirectUris = new List<string>();
AllowedCorsOrigins = new List<string>();
PostLogoutRedirectUris = new List<string>();
IdentityProviderRestrictions = new List<string>();
Properties = new Dictionary<string, string>();
Secrets = new List<SecretCreateOrUpdateDto>();
}
}
}

19
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/ClientUpdateInputDto.cs

@ -1,19 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class ClientUpdateInputDto
{
[Required]
public Guid Id { get; set; }
[Required]
public ClientUpdateDto Client { get; set; }
public ClientUpdateInputDto()
{
Client = new ClientUpdateDto();
}
}
}

7
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/Dto/SecretCreateOrUpdateDto.cs

@ -0,0 +1,7 @@
namespace LINGYUN.Abp.IdentityServer.Clients
{
public class SecretCreateOrUpdateDto : SecretBaseDto
{
public HashType HashType { get; set; }
}
}

42
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Clients/IClientAppService.cs

@ -1,39 +1,17 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.IdentityServer.Clients
{
public interface IClientAppService : IApplicationService
public interface IClientAppService :
ICrudAppService<
ClientDto,
Guid,
ClientGetByPagedDto,
ClientCreateDto,
ClientUpdateDto>
{
Task<ClientDto> GetAsync(ClientGetByIdInputDto clientGetById);
Task<PagedResultDto<ClientDto>> GetAsync(ClientGetByPagedInputDto clientGetByPaged);
Task<ClientDto> CreateAsync(ClientCreateDto clientCreate);
Task<ClientDto> UpdateAsync(ClientUpdateInputDto clientUpdateInput);
Task<ClientDto> CloneAsync(ClientCloneInputDto clientCloneInput);
Task DeleteAsync(ClientGetByIdInputDto clientGetByIdInput);
Task<ClientClaimDto> AddClaimAsync(ClientClaimCreateDto clientClaimCreate);
Task<ClientClaimDto> UpdateClaimAsync(ClientClaimUpdateDto clientClaimUpdate);
Task DeleteClaimAsync(ClientClaimGetByKeyInputDto clientClaimGetByKey);
Task<ClientPropertyDto> AddPropertyAsync(ClientPropertyCreateDto clientPropertyCreate);
Task<ClientPropertyDto> UpdatePropertyAsync(ClientPropertyUpdateDto clientPropertyUpdate);
Task DeletePropertyAsync(ClientPropertyGetByKeyDto clientPropertyGetByKey);
Task<ClientSecretDto> AddSecretAsync(ClientSecretCreateDto clientSecretCreate);
Task<ClientSecretDto> UpdateSecretAsync(ClientSecretUpdateDto clientSecretUpdate);
Task DeleteSecretAsync(ClientSecretGetByTypeDto clientSecretGetByType);
Task<ClientDto> CloneAsync(Guid id, ClientCloneDto input);
}
}

7
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityClaimDto.cs

@ -1,7 +0,0 @@
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityClaimDto
{
public string Type { get; set; }
}
}

12
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceCreateDto.cs → aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceCreateOrUpdateDto.cs

@ -5,7 +5,7 @@ using Volo.Abp.Validation;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourceCreateDto
public class IdentityResourceCreateOrUpdateDto
{
[Required]
[DynamicStringLength(typeof(IdentityResourceConsts), nameof(IdentityResourceConsts.NameMaxLength))]
@ -25,14 +25,18 @@ namespace LINGYUN.Abp.IdentityServer.IdentityResources
public bool ShowInDiscoveryDocument { get; set; }
public List<IdentityClaimDto> UserClaims { get; set; }
public List<string> UserClaims { get; set; }
public IdentityResourceCreateDto()
public Dictionary<string, string> Properties { get; set; }
public IdentityResourceCreateOrUpdateDto()
{
UserClaims = new List<string>();
Properties = new Dictionary<string, string>();
Enabled = true;
Required = false;
ShowInDiscoveryDocument = false;
UserClaims = new List<IdentityClaimDto>();
}
}
}

12
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceDto.cs

@ -1,8 +1,6 @@
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
{
@ -10,10 +8,8 @@ namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public string Name { get; set; }
public string DisplayName { get; set; }
public string Description { get; set; }
public string ConcurrencyStamp { get; set; }
@ -26,14 +22,14 @@ namespace LINGYUN.Abp.IdentityServer.IdentityResources
public bool ShowInDiscoveryDocument { get; set; }
public List<IdentityClaimDto> UserClaims { get; set; }
public List<string> UserClaims { get; set; }
public List<IdentityResourcePropertyDto> Properties { get; set; }
public Dictionary<string, string> Properties { get; set; }
public IdentityResourceDto()
{
UserClaims = new List<IdentityClaimDto>();
Properties = new List<IdentityResourcePropertyDto>();
UserClaims = new List<string>();
Properties = new Dictionary<string, string>();
}
}
}

9
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByIdInputDto.cs

@ -1,9 +0,0 @@
using System;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourceGetByIdInputDto : EntityDto<Guid>
{
}
}

2
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByPagedInputDto.cs → aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceGetByPagedDto.cs

@ -2,7 +2,7 @@
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourceGetByPagedInputDto : PagedAndSortedResultRequestDto
public class IdentityResourceGetByPagedDto : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
}

23
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyCreateDto.cs

@ -1,23 +0,0 @@
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; }
}
}

9
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyDto.cs

@ -1,9 +0,0 @@
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourcePropertyDto
{
public string Key { get; set; }
public string Value { get; set; }
}
}

15
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourcePropertyGetByKeyDto.cs

@ -1,15 +0,0 @@
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; }
}
}

45
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/Dto/IdentityResourceUpdateDto.cs

@ -1,45 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.IdentityServer.IdentityResources;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public class IdentityResourceUpdateDto
{
[Required]
public Guid Id { get; set; }
[Required]
[StringLength(2000)]
public string ConcurrencyStamp { get; set; }
[DynamicStringLength(typeof(IdentityResourceConsts), nameof(IdentityResourceConsts.NameMaxLength))]
public string Name { get; set; }
[DynamicStringLength(typeof(IdentityResourceConsts), nameof(IdentityResourceConsts.DisplayNameMaxLength))]
public string DisplayName { get; set; }
[DynamicStringLength(typeof(IdentityResourceConsts), nameof(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<IdentityClaimDto> UserClaims { get; set; }
public IdentityResourceUpdateDto()
{
Enabled = true;
Required = false;
ShowInDiscoveryDocument = false;
UserClaims = new List<IdentityClaimDto>();
}
}
}

25
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/IdentityResources/IIdentityResourceAppService.cs

@ -1,23 +1,16 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using System;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
public interface IIdentityResourceAppService : IApplicationService
public interface IIdentityResourceAppService :
ICrudAppService<
IdentityResourceDto,
Guid,
IdentityResourceGetByPagedDto,
IdentityResourceCreateOrUpdateDto,
IdentityResourceCreateOrUpdateDto
>
{
Task<IdentityResourceDto> GetAsync(IdentityResourceGetByIdInputDto identityResourceGetById);
Task<PagedResultDto<IdentityResourceDto>> GetAsync(IdentityResourceGetByPagedInputDto identityResourceGetByPaged);
Task<IdentityResourceDto> CreateAsync(IdentityResourceCreateDto identityResourceCreate);
Task<IdentityResourceDto> UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate);
Task DeleteAsync(IdentityResourceGetByIdInputDto identityResourceGetById);
Task<IdentityResourcePropertyDto> AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate);
Task DeletePropertyAsync(IdentityResourcePropertyGetByKeyDto identityResourcePropertyGetByKey);
}
}

25
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/en.json

@ -26,6 +26,29 @@
"ClientSecretNotFound": "Client secret: {0} not found!",
"ClientPropertyNotFound": "Client property: {0} not found!",
"IdentityResourcePropertyNotFound": "Identity resource property: {0} not found!",
"EncryptionNotImplemented": "Encryption type: {0} not implemented!"
"EncryptionNotImplemented": "Encryption type: {0} not implemented!",
"Information": "Info",
"Resource:Enabled": "Enabled",
"Resource:New": "Add New",
"Resource:Edit": "Edit",
"Resource:Name": "Resource - {0}",
"UserClaim": "User claim",
"NoClaim": "Owned claims",
"ExistsClaim": "Not owned claims",
"Scope": "Scopes",
"Secret": "Secrets",
"Name": "Name",
"DisplayName": "Display Name",
"Description": "Description",
"Required": "Required",
"Emphasize": "Emphasize",
"ShowInDiscoveryDocument": "Show In Discovery Document",
"Expiration": "Expiration",
"Scope:New": "Add New",
"Scope:Delete": "Delete",
"Secret:New": "Add New",
"Secret:Type": "Type",
"Secret:HashType": "Hash Type",
"Secret:Value": "Value"
}
}

26
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/Localization/Resources/zh-Hans.json

@ -26,6 +26,30 @@
"ClientSecretNotFound": "客户端密钥: {0} 不存在!",
"ClientPropertyNotFound": "客户端属性: {0} 不存在!",
"IdentityResourcePropertyNotFound": "身份资源属性: {0} 不存在!",
"EncryptionNotImplemented": "加密类型: {0} 未实现!"
"EncryptionNotImplemented": "加密类型: {0} 未实现!",
"Information": "信息",
"Resource:Enabled": "启用资源",
"Resource:New": "添加新资源",
"Resource:Edit": "编辑资源",
"Resource:Delete": "删除资源",
"Resource:Name": "资源 - {0}",
"UserClaim": "用户声明",
"NoClaim": "未拥有声明",
"ExistsClaim": "已拥有声明",
"Scope": "作用域",
"Secret": "密钥",
"Name": "名称",
"DisplayName": "显示名称",
"Description": "描述",
"Required": "必要",
"Emphasize": "强调",
"ShowInDiscoveryDocument": "强调",
"Expiration": "过期",
"Scope:New": "添加新作用域",
"Scope:Delete": "删除作用域",
"Secret:New": "添加新密钥",
"Secret:Type": "密钥类型",
"Secret:HashType": "哈希类型",
"Secret:Value": "值"
}
}

3
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application.Contracts/LINGYUN/Abp/IdentityServer/SecretBaseDto.cs

@ -1,9 +1,8 @@
using System;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Abp.IdentityServer
{
public abstract class SecretBaseDto : EntityDto
public class SecretBaseDto
{
public string Type { get; set; }

46
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/AbpIdentityServerAutoMapperProfile.cs

@ -3,6 +3,7 @@ using LINGYUN.Abp.IdentityServer.ApiResources;
using LINGYUN.Abp.IdentityServer.Clients;
using LINGYUN.Abp.IdentityServer.IdentityResources;
using System.Collections.Generic;
using System.Linq;
using Volo.Abp.IdentityServer.ApiResources;
using Volo.Abp.IdentityServer.Clients;
using Volo.Abp.IdentityServer.IdentityResources;
@ -15,36 +16,31 @@ namespace LINGYUN.Abp.IdentityServer
{
CreateMap<ClientSecret, ClientSecretDto>();
CreateMap<ClientClaim, ClientClaimDto>();
CreateMap<ClientCorsOrigin, ClientCorsOriginDto>();
CreateMap<ClientGrantType, ClientGrantTypeDto>();
CreateMap<ClientIdPRestriction, ClientIdPRestrictionDto>();
CreateMap<ClientPostLogoutRedirectUri, ClientPostLogoutRedirectUriDto>();
CreateMap<ClientProperty, ClientPropertyDto>();
CreateMap<ClientRedirectUri, ClientRedirectUriDto>();
CreateMap<ClientScope, ClientScopeDto>();
CreateMap<Client, ClientDto>();
CreateMap<List<ClientProperty>, Dictionary<string, string>>()
.ConstructUsing((props, ctx) =>
{
var properties = new Dictionary<string, string>();
foreach (var prop in props)
{
properties.Add(prop.Key, prop.Value);
}
return properties;
});
CreateMap<Client, ClientDto>()
.ForMember(dto => dto.AllowedCorsOrigins, map => map.MapFrom(client => client.AllowedCorsOrigins.Select(origin => origin.Origin).ToList()))
.ForMember(dto => dto.AllowedGrantTypes, map => map.MapFrom(client => client.AllowedGrantTypes.Select(grantType => grantType.GrantType).ToList()))
.ForMember(dto => dto.AllowedScopes, map => map.MapFrom(client => client.AllowedScopes.Select(scope => scope.Scope).ToList()))
.ForMember(dto => dto.IdentityProviderRestrictions, map => map.MapFrom(client => client.IdentityProviderRestrictions.Select(provider => provider.Provider).ToList()))
.ForMember(dto => dto.PostLogoutRedirectUris, map => map.MapFrom(client => client.PostLogoutRedirectUris.Select(uri => uri.PostLogoutRedirectUri).ToList()))
.ForMember(dto => dto.RedirectUris, map => map.MapFrom(client => client.RedirectUris.Select(uri => uri.RedirectUri).ToList()));
CreateMap<ApiSecret, ApiSecretDto>();
CreateMap<ApiScope, ApiScopeDto>();
CreateMap<ApiScopeClaim, ApiScopeClaimDto>();
CreateMap<ApiResourceClaim, ApiResourceClaimDto>();
CreateMap<ApiResource, ApiResourceDto>();
CreateMap<ApiResource, ApiResourceDto>()
.ForMember(dto => dto.UserClaims, map => map.MapFrom(src => src.UserClaims.Select(claim => claim.Type).ToList()));
CreateMap<IdentityClaim, IdentityClaimDto>();
CreateMap<IdentityResource, IdentityResourceDto>()
.ForMember(dto => dto.Properties, map => map.MapFrom((src, d) =>
{
var properties = new List<IdentityResourcePropertyDto>();
foreach (var property in src.Properties)
{
properties.Add(new IdentityResourcePropertyDto
{
Key = property.Key,
Value = property.Value
});
}
return properties;
}));
.ForMember(dto => dto.UserClaims, map => map.MapFrom(src => src.UserClaims.Select(claim => claim.Type).ToList()));
}
}
}

152
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceAppService.cs

@ -1,7 +1,9 @@
using IdentityServer4;
using IdentityServer4.Models;
using Microsoft.AspNetCore.Authorization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
@ -21,18 +23,19 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources
ApiResourceRepository = apiResourceRepository;
}
public virtual async Task<ApiResourceDto> GetAsync(ApiResourceGetByIdInputDto apiResourceGetById)
public virtual async Task<ApiResourceDto> GetAsync(Guid id)
{
var apiResource = await ApiResourceRepository.GetAsync(apiResourceGetById.Id);
var apiResource = await ApiResourceRepository.GetAsync(id);
return ObjectMapper.Map<ApiResource, ApiResourceDto>(apiResource);
}
public virtual async Task<PagedResultDto<ApiResourceDto>> GetAsync(ApiResourceGetByPagedInputDto apiResourceGetByPaged)
public virtual async Task<PagedResultDto<ApiResourceDto>> GetListAsync(ApiResourceGetByPagedInputDto input)
{
var apiResources = await ApiResourceRepository.GetListAsync(apiResourceGetByPaged.Sorting,
apiResourceGetByPaged.SkipCount, apiResourceGetByPaged.MaxResultCount,
apiResourceGetByPaged.Filter);
var apiResources = await ApiResourceRepository.GetListAsync(input.Sorting,
input.SkipCount, input.MaxResultCount,
input.Filter);
// 未加Filter过滤器? 结果数不准
var apiResourceCount = await ApiResourceRepository.GetCountAsync();
return new PagedResultDto<ApiResourceDto>(apiResourceCount,
@ -40,102 +43,125 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources
}
[Authorize(AbpIdentityServerPermissions.ApiResources.Create)]
public virtual async Task<ApiResourceDto> CreateAsync(ApiResourceCreateDto apiResourceCreate)
public virtual async Task<ApiResourceDto> CreateAsync(ApiResourceCreateDto input)
{
var apiResourceExists = await ApiResourceRepository.CheckNameExistAsync(apiResourceCreate.Name);
var apiResourceExists = await ApiResourceRepository.CheckNameExistAsync(input.Name);
if (apiResourceExists)
{
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ApiResourceNameExisted, apiResourceCreate.Name]);
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ApiResourceNameExisted, input.Name]);
}
var apiResource = new ApiResource(GuidGenerator.Create(), apiResourceCreate.Name,
apiResourceCreate.DisplayName, apiResourceCreate.Description)
var apiResource = new ApiResource(GuidGenerator.Create(), input.Name,
input.DisplayName, input.Description)
{
Enabled = apiResourceCreate.Enabled
Enabled = input.Enabled
};
foreach (var userClaim in apiResourceCreate.UserClaims)
{
apiResource.AddUserClaim(userClaim.Type);
}
UpdateApiResourceByInput(apiResource, input);
apiResource = await ApiResourceRepository.InsertAsync(apiResource);
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<ApiResource, ApiResourceDto>(apiResource);
}
[Authorize(AbpIdentityServerPermissions.ApiResources.Update)]
public virtual async Task<ApiResourceDto> UpdateAsync(ApiResourceUpdateDto apiResourceUpdate)
public virtual async Task<ApiResourceDto> UpdateAsync(Guid id, ApiResourceUpdateDto input)
{
var apiResource = await ApiResourceRepository.GetAsync(apiResourceUpdate.Id);
apiResource.DisplayName = apiResourceUpdate.DisplayName ?? apiResource.DisplayName;
apiResource.Description = apiResourceUpdate.Description ?? apiResource.Description;
apiResource.Enabled = apiResourceUpdate.Enabled;
var apiResource = await ApiResourceRepository.GetAsync(id);
apiResource.DisplayName = input.DisplayName ?? apiResource.DisplayName;
apiResource.Description = input.Description ?? apiResource.Description;
apiResource.Enabled = input.Enabled;
UpdateApiResourceByInput(apiResource, input);
apiResource.RemoveAllUserClaims();
foreach (var userClaim in apiResourceUpdate.UserClaims)
{
apiResource.AddUserClaim(userClaim.Type);
}
apiResource = await ApiResourceRepository.UpdateAsync(apiResource);
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<ApiResource, ApiResourceDto>(apiResource);
}
[Authorize(AbpIdentityServerPermissions.ApiResources.Delete)]
public virtual async Task DeleteAsync(ApiResourceGetByIdInputDto apiResourceGetById)
public virtual async Task DeleteAsync(Guid id)
{
var apiResource = await ApiResourceRepository.GetAsync(apiResourceGetById.Id);
var apiResource = await ApiResourceRepository.GetAsync(id);
await ApiResourceRepository.DeleteAsync(apiResource);
await CurrentUnitOfWork.SaveChangesAsync();
}
[Authorize(AbpIdentityServerPermissions.ApiResources.Secrets.Create)]
public virtual async Task<ApiSecretDto> AddSecretAsync(ApiSecretCreateDto apiSecretCreate)
protected virtual void UpdateApiResourceByInput(ApiResource apiResource, ApiResourceCreateOrUpdateDto input)
{
var apiResource = await ApiResourceRepository.GetAsync(apiSecretCreate.ApiResourceId);
var apiSecretValue = apiSecretCreate.Value;
var apiResourceSecret = apiResource.FindSecret(apiSecretValue, apiSecretCreate.Type);
if(apiResourceSecret == null)
// 删除不存在的UserClaim
apiResource.UserClaims.RemoveAll(claim => !input.UserClaims.Contains(claim.Type));
foreach (var inputClaim in input.UserClaims)
{
if (IdentityServerConstants.SecretTypes.SharedSecret.Equals(apiSecretCreate.Type))
var userClaim = apiResource.FindClaim(inputClaim);
if (userClaim == null)
{
apiResource.AddUserClaim(inputClaim);
}
}
// 删除不存在的Scope
apiResource.Scopes.RemoveAll(scope => !input.Scopes.Any(inputScope => scope.Name == inputScope.Name));
foreach (var inputScope in input.Scopes)
{
if (apiSecretCreate.HashType == HashType.Sha256)
var scope = apiResource.FindScope(inputScope.Name);
if (scope == null)
{
apiSecretValue = apiSecretCreate.Value.Sha256();
scope = apiResource.AddScope(
inputScope.Name, inputScope.DisplayName, inputScope.Description,
inputScope.Required, inputScope.Emphasize, inputScope.ShowInDiscoveryDocument);
}
else if (apiSecretCreate.HashType == HashType.Sha512)
else
{
apiSecretValue = apiSecretCreate.Value.Sha512();
scope.Required = inputScope.Required;
scope.Emphasize = inputScope.Emphasize;
scope.Description = inputScope.Description;
scope.DisplayName = inputScope.DisplayName;
scope.ShowInDiscoveryDocument = inputScope.ShowInDiscoveryDocument;
// 删除不存在的ScopeUserClaim
scope.UserClaims.RemoveAll(claim => !inputScope.UserClaims.Contains(claim.Type));
}
foreach (var inputScopeClaim in inputScope.UserClaims)
{
var scopeUserClaim = scope.FindClaim(inputScopeClaim);
if (scopeUserClaim == null)
{
scope.AddUserClaim(inputScopeClaim);
}
apiResource.AddSecret(apiSecretValue, apiSecretCreate.Expiration, apiSecretCreate.Type, apiSecretCreate.Description);
apiResourceSecret = apiResource.FindSecret(apiSecretValue, apiSecretCreate.Type);
}
return ObjectMapper.Map<ApiSecret, ApiSecretDto>(apiResourceSecret);
}
[Authorize(AbpIdentityServerPermissions.ApiResources.Secrets.Delete)]
public virtual async Task DeleteSecretAsync(ApiSecretGetByTypeInputDto apiSecretGetByType)
// 删除不存在的Secret
apiResource.Secrets.RemoveAll(secret => !input.Secrets.Any(inputSecret => secret.Type == inputSecret.Type && secret.Value == inputSecret.Value));
foreach (var inputSecret in input.Secrets)
{
var apiResource = await ApiResourceRepository.GetAsync(apiSecretGetByType.ApiResourceId);
apiResource.RemoveSecret(apiSecretGetByType.Value, apiSecretGetByType.Type);
}
[Authorize(AbpIdentityServerPermissions.ApiResources.Scope.Create)]
public virtual async Task<ApiScopeDto> AddScopeAsync(ApiScopeCreateDto apiScopeCreate)
// 第一次重复校验已经加密过的字符串
if (apiResource.FindSecret(inputSecret.Value, inputSecret.Type) == null)
{
var apiResource = await ApiResourceRepository.GetAsync(apiScopeCreate.ApiResourceId);
var apiResourceScope = apiResource.FindScope(apiScopeCreate.Name);
if (apiResourceScope == null)
var apiSecretValue = inputSecret.Value;
if (IdentityServerConstants.SecretTypes.SharedSecret.Equals(inputSecret.Type))
{
apiResource.AddScope(apiScopeCreate.Name, apiScopeCreate.DisplayName, apiScopeCreate.Description,
apiScopeCreate.Required, apiScopeCreate.Emphasize, apiScopeCreate.ShowInDiscoveryDocument);
apiResourceScope = apiResource.FindScope(apiScopeCreate.Name);
if (inputSecret.HashType == HashType.Sha256)
{
apiSecretValue = inputSecret.Value.Sha256();
}
else if (inputSecret.HashType == HashType.Sha512)
{
apiSecretValue = inputSecret.Value.Sha512();
}
return ObjectMapper.Map<ApiScope, ApiScopeDto>(apiResourceScope);
}
[Authorize(AbpIdentityServerPermissions.ApiResources.Scope.Delete)]
public virtual async Task DeleteScopeAsync(ApiScopeGetByNameInputDto apiScopeGetByName)
// 加密之后还需要做一次校验 避免出现重复值
var secret = apiResource.FindSecret(apiSecretValue, inputSecret.Type);
if (secret == null)
{
var apiResource = await ApiResourceRepository.GetAsync(apiScopeGetByName.ApiResourceId);
apiResource.RemoveScope(apiScopeGetByName.Name);
apiResource.AddSecret(apiSecretValue, inputSecret.Expiration, inputSecret.Type, inputSecret.Description);
}
}
}
}
}
}

474
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/Clients/ClientAppService.cs

@ -1,6 +1,7 @@
using IdentityServer4;
using IdentityServer4.Models;
using Microsoft.AspNetCore.Authorization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -21,61 +22,6 @@ namespace LINGYUN.Abp.IdentityServer.Clients
ClientRepository = clientRepository;
}
[Authorize(AbpIdentityServerPermissions.Clients.Claims.Create)]
public virtual async Task<ClientClaimDto> AddClaimAsync(ClientClaimCreateDto clientClaimCreate)
{
var client = await ClientRepository.GetAsync(clientClaimCreate.ClientId);
client.AddClaim(clientClaimCreate.Value, clientClaimCreate.Type);
var clientClaim = client.FindClaim(clientClaimCreate.Value, clientClaimCreate.Type);
return ObjectMapper.Map<ClientClaim, ClientClaimDto>(clientClaim);
}
[Authorize(AbpIdentityServerPermissions.Clients.Properties.Create)]
public virtual async Task<ClientPropertyDto> AddPropertyAsync(ClientPropertyCreateDto clientPropertyCreate)
{
var client = await ClientRepository.GetAsync(clientPropertyCreate.ClientId);
client.AddProperty(clientPropertyCreate.Key, clientPropertyCreate.Value);
var clientProperty = client.FindProperty(clientPropertyCreate.Key, clientPropertyCreate.Value);
return ObjectMapper.Map<ClientProperty, ClientPropertyDto>(clientProperty);
}
[Authorize(AbpIdentityServerPermissions.Clients.Secrets.Create)]
public virtual async Task<ClientSecretDto> AddSecretAsync(ClientSecretCreateDto clientSecretCreate)
{
var client = await ClientRepository.GetAsync(clientSecretCreate.ClientId);
var clientSecretValue = clientSecretCreate.Value;
// 如果是 SharedSecret 类型的密钥
// 采用 IdentityServer4 服务器扩展方法加密
if (IdentityServerConstants.SecretTypes.SharedSecret.Equals(clientSecretCreate.Type))
{
if(clientSecretCreate.HashType == HashType.Sha256)
{
clientSecretValue = clientSecretCreate.Value.Sha256();
}
else if (clientSecretCreate.HashType == HashType.Sha512)
{
clientSecretValue = clientSecretCreate.Value.Sha512();
}
}
else
{
// 其他类型的服务器加密方式暂时不提供
throw new UserFriendlyException(L["EncryptionNotImplemented", clientSecretCreate.Type]);
}
client.AddSecret(clientSecretValue, clientSecretCreate.Expiration,
clientSecretCreate.Type, clientSecretCreate.Description);
var clientSecret = client.FindSecret(clientSecretValue, clientSecretCreate.Type);
return ObjectMapper.Map<ClientSecret, ClientSecretDto>(clientSecret);
}
[Authorize(AbpIdentityServerPermissions.Clients.Create)]
public virtual async Task<ClientDto> CreateAsync(ClientCreateDto clientCreate)
{
@ -91,58 +37,37 @@ namespace LINGYUN.Abp.IdentityServer.Clients
};
foreach (var grantType in clientCreate.AllowedGrantTypes)
{
client.AddGrantType(grantType.GrantType);
client.AddGrantType(grantType);
}
client = await ClientRepository.InsertAsync(client, true);
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<Client, ClientDto>(client);
}
[Authorize(AbpIdentityServerPermissions.Clients.Delete)]
public virtual async Task DeleteAsync(ClientGetByIdInputDto clientGetByIdInput)
public virtual async Task DeleteAsync(Guid id)
{
await ClientRepository.DeleteAsync(clientGetByIdInput.Id);
}
await ClientRepository.DeleteAsync(id);
[Authorize(AbpIdentityServerPermissions.Clients.Claims.Delete)]
public virtual async Task DeleteClaimAsync(ClientClaimGetByKeyInputDto clientClaimGetByKey)
{
var client = await ClientRepository.GetAsync(clientClaimGetByKey.ClientId);
client.RemoveClaim(clientClaimGetByKey.Value, clientClaimGetByKey.Type);
await ClientRepository.UpdateAsync(client);
}
[Authorize(AbpIdentityServerPermissions.Clients.Properties.Delete)]
public virtual async Task DeletePropertyAsync(ClientPropertyGetByKeyDto clientPropertyGetByKey)
{
var client = await ClientRepository.GetAsync(clientPropertyGetByKey.ClientId);
client.RemoveProperty(clientPropertyGetByKey.Key, clientPropertyGetByKey.Value);
await ClientRepository.UpdateAsync(client);
await CurrentUnitOfWork.SaveChangesAsync();
}
[Authorize(AbpIdentityServerPermissions.Clients.Secrets.Delete)]
public virtual async Task DeleteSecretAsync(ClientSecretGetByTypeDto clientSecretGetByType)
{
var client = await ClientRepository.GetAsync(clientSecretGetByType.ClientId);
client.RemoveSecret(clientSecretGetByType.Value, clientSecretGetByType.Type);
await ClientRepository.UpdateAsync(client);
}
public virtual async Task<ClientDto> GetAsync(ClientGetByIdInputDto clientGetById)
public virtual async Task<ClientDto> GetAsync(Guid id)
{
var client = await ClientRepository.GetAsync(clientGetById.Id);
var client = await ClientRepository.GetAsync(id);
return ObjectMapper.Map<Client, ClientDto>(client);
}
public virtual async Task<PagedResultDto<ClientDto>> GetAsync(ClientGetByPagedInputDto clientGetByPaged)
public virtual async Task<PagedResultDto<ClientDto>> GetListAsync(ClientGetByPagedDto input)
{
// Abp官方IdentityServer项目不支持Filter过滤...
var clients = await ClientRepository.GetListAsync(clientGetByPaged.Sorting,
clientGetByPaged.SkipCount, clientGetByPaged.MaxResultCount,
clientGetByPaged.Filter, true);
var clients = await ClientRepository.GetListAsync(input.Sorting,
input.SkipCount, input.MaxResultCount,
input.Filter, true);
var clientCount = await ClientRepository.GetCountAsync();
@ -151,127 +76,238 @@ namespace LINGYUN.Abp.IdentityServer.Clients
}
[Authorize(AbpIdentityServerPermissions.Clients.Update)]
public virtual async Task<ClientDto> UpdateAsync(ClientUpdateInputDto clientUpdateInput)
{
var client = await ClientRepository.GetAsync(clientUpdateInput.Id);
#region Basic Property
client.ConcurrencyStamp = clientUpdateInput.Client.ConcurrencyStamp;
client.ClientId = clientUpdateInput.Client.ClientId ?? client.ClientId;
client.ClientUri = clientUpdateInput.Client.ClientUri ?? client.ClientUri;
client.ClientName = clientUpdateInput.Client.ClientName ?? client.ClientName;
client.AbsoluteRefreshTokenLifetime = clientUpdateInput.Client.AbsoluteRefreshTokenLifetime
?? client.AbsoluteRefreshTokenLifetime;
client.AccessTokenLifetime = clientUpdateInput.Client.AccessTokenLifetime
?? client.AccessTokenLifetime;
client.AccessTokenType = clientUpdateInput.Client.AccessTokenType ?? client.AccessTokenType;
client.AllowAccessTokensViaBrowser = clientUpdateInput.Client.AllowAccessTokensViaBrowser
?? client.AllowAccessTokensViaBrowser;
client.AllowOfflineAccess = clientUpdateInput.Client.AllowOfflineAccess
?? client.AllowOfflineAccess;
client.AllowPlainTextPkce = clientUpdateInput.Client.AllowPlainTextPkce ?? client.AllowPlainTextPkce;
client.AllowRememberConsent = clientUpdateInput.Client.AllowRememberConsent ?? client.AllowRememberConsent;
client.AlwaysIncludeUserClaimsInIdToken = clientUpdateInput.Client.AlwaysIncludeUserClaimsInIdToken
?? client.AlwaysIncludeUserClaimsInIdToken;
client.AlwaysSendClientClaims = clientUpdateInput.Client.AlwaysSendClientClaims ?? client.AlwaysSendClientClaims;
client.AuthorizationCodeLifetime = clientUpdateInput.Client.AuthorizationCodeLifetime
?? client.AuthorizationCodeLifetime;
client.BackChannelLogoutSessionRequired = clientUpdateInput.Client.BackChannelLogoutSessionRequired
?? client.BackChannelLogoutSessionRequired;
client.BackChannelLogoutUri = clientUpdateInput.Client.BackChannelLogoutUri
?? client.BackChannelLogoutUri;
client.ClientClaimsPrefix = clientUpdateInput.Client.ClientClaimsPrefix ?? client.ClientClaimsPrefix;
client.ConsentLifetime = clientUpdateInput.Client.ConsentLifetime ?? client.ConsentLifetime;
client.Description = clientUpdateInput.Client.Description ?? client.Description;
client.DeviceCodeLifetime = clientUpdateInput.Client.DeviceCodeLifetime ?? client.DeviceCodeLifetime;
client.Enabled = clientUpdateInput.Client.Enabled ?? client.Enabled;
client.EnableLocalLogin = clientUpdateInput.Client.EnableLocalLogin ?? client.EnableLocalLogin;
client.FrontChannelLogoutSessionRequired = clientUpdateInput.Client.FrontChannelLogoutSessionRequired
?? client.FrontChannelLogoutSessionRequired;
client.FrontChannelLogoutUri = clientUpdateInput.Client.FrontChannelLogoutUri ?? client.FrontChannelLogoutUri;
client.IdentityTokenLifetime = clientUpdateInput.Client.IdentityTokenLifetime ?? client.IdentityTokenLifetime;
client.IncludeJwtId = clientUpdateInput.Client.IncludeJwtId ?? client.IncludeJwtId;
client.LogoUri = clientUpdateInput.Client.LogoUri ?? client.LogoUri;
client.PairWiseSubjectSalt = clientUpdateInput.Client.PairWiseSubjectSalt ?? client.PairWiseSubjectSalt;
client.ProtocolType = clientUpdateInput.Client.ProtocolType ?? client.ProtocolType;
client.RefreshTokenExpiration = clientUpdateInput.Client.RefreshTokenExpiration ?? client.RefreshTokenExpiration;
client.RefreshTokenUsage = clientUpdateInput.Client.RefreshTokenUsage ?? client.RefreshTokenUsage;
client.RequireClientSecret = clientUpdateInput.Client.RequireClientSecret ?? client.RequireClientSecret;
client.RequireConsent = clientUpdateInput.Client.RequireConsent ?? client.RequireConsent;
client.RequirePkce = clientUpdateInput.Client.RequirePkce ?? client.RequirePkce;
client.SlidingRefreshTokenLifetime = clientUpdateInput.Client.SlidingRefreshTokenLifetime
?? client.SlidingRefreshTokenLifetime;
client.UpdateAccessTokenClaimsOnRefresh = clientUpdateInput.Client.UpdateAccessTokenClaimsOnRefresh
?? client.UpdateAccessTokenClaimsOnRefresh;
client.UserCodeType = clientUpdateInput.Client.UserCodeType ?? client.UserCodeType;
client.UserSsoLifetime = clientUpdateInput.Client.UserSsoLifetime ?? client.UserSsoLifetime;
public virtual async Task<ClientDto> UpdateAsync(Guid id, ClientUpdateDto input)
{
var client = await ClientRepository.GetAsync(id);
#region Basic
if (!string.Equals(client.ClientId, input.ClientId, StringComparison.InvariantCultureIgnoreCase))
{
client.ClientId = input.ClientId;
}
if (!string.Equals(client.ClientUri, input.ClientUri, StringComparison.InvariantCultureIgnoreCase))
{
client.ClientUri = input.ClientUri;
}
if (!string.Equals(client.ClientName, input.ClientName, StringComparison.InvariantCultureIgnoreCase))
{
client.ClientName = input.ClientName;
}
if (!string.Equals(client.BackChannelLogoutUri, input.BackChannelLogoutUri, StringComparison.InvariantCultureIgnoreCase))
{
client.BackChannelLogoutUri = input.BackChannelLogoutUri;
}
if (!string.Equals(client.FrontChannelLogoutUri, input.FrontChannelLogoutUri, StringComparison.InvariantCultureIgnoreCase))
{
client.FrontChannelLogoutUri = input.FrontChannelLogoutUri;
}
if (!string.Equals(client.ClientClaimsPrefix, input.ClientClaimsPrefix, StringComparison.InvariantCultureIgnoreCase))
{
client.ClientClaimsPrefix = input.ClientClaimsPrefix;
}
if (!string.Equals(client.Description, input.Description, StringComparison.InvariantCultureIgnoreCase))
{
client.Description = input.Description;
}
if (!string.Equals(client.LogoUri, input.LogoUri, StringComparison.InvariantCultureIgnoreCase))
{
client.LogoUri = input.LogoUri;
}
if (!string.Equals(client.UserCodeType, input.UserCodeType, StringComparison.InvariantCultureIgnoreCase))
{
client.UserCodeType = input.UserCodeType;
}
if (!string.Equals(client.PairWiseSubjectSalt, input.PairWiseSubjectSalt, StringComparison.InvariantCultureIgnoreCase))
{
client.PairWiseSubjectSalt = input.PairWiseSubjectSalt;
}
if (!string.Equals(client.ProtocolType, input.ProtocolType, StringComparison.InvariantCultureIgnoreCase))
{
client.ProtocolType = input.ProtocolType;
}
client.AbsoluteRefreshTokenLifetime = input.AbsoluteRefreshTokenLifetime;
client.AccessTokenLifetime = input.AccessTokenLifetime;
client.AccessTokenType = input.AccessTokenType;
client.AllowAccessTokensViaBrowser = input.AllowAccessTokensViaBrowser;
client.AllowOfflineAccess = input.AllowOfflineAccess;
client.AllowPlainTextPkce = input.AllowPlainTextPkce;
client.AllowRememberConsent = input.AllowRememberConsent;
client.AlwaysIncludeUserClaimsInIdToken = input.AlwaysIncludeUserClaimsInIdToken;
client.AlwaysSendClientClaims = input.AlwaysSendClientClaims;
client.AuthorizationCodeLifetime = input.AuthorizationCodeLifetime;
client.BackChannelLogoutSessionRequired = input.BackChannelLogoutSessionRequired;
client.DeviceCodeLifetime = input.DeviceCodeLifetime;
client.ConsentLifetime = input.ConsentLifetime ?? client.ConsentLifetime;
client.Enabled = input.Enabled;
client.EnableLocalLogin = input.EnableLocalLogin;
client.FrontChannelLogoutSessionRequired = input.FrontChannelLogoutSessionRequired;
client.IdentityTokenLifetime = input.IdentityTokenLifetime;
client.IncludeJwtId = input.IncludeJwtId;
client.RefreshTokenExpiration = input.RefreshTokenExpiration;
client.RefreshTokenUsage = input.RefreshTokenUsage;
client.RequireClientSecret = input.RequireClientSecret;
client.RequireConsent = input.RequireConsent;
client.RequirePkce = input.RequirePkce;
client.SlidingRefreshTokenLifetime = input.SlidingRefreshTokenLifetime;
client.UpdateAccessTokenClaimsOnRefresh = input.UpdateAccessTokenClaimsOnRefresh;
client.UserSsoLifetime = input.UserSsoLifetime ?? client.UserSsoLifetime;
#endregion
#region AllowScope
// 删除未在身份资源和Api资源中的作用域
client.AllowedScopes.RemoveAll(scope =>
!input.IdentityResources.Contains(scope.Scope) &&
!input.ApiResources.Contains(scope.Scope));
client.RemoveAllScopes();
foreach (var scope in clientUpdateInput.Client.AllowedScopes)
foreach (var apiResource in input.ApiResources)
{
client.AddScope(scope.Scope);
if (client.FindScope(apiResource) == null)
{
client.AddScope(apiResource);
}
}
foreach (var identityResource in input.IdentityResources)
{
if (client.FindScope(identityResource) == null)
{
client.AddScope(identityResource);
}
}
#endregion
#region RedirectUris
client.RemoveAllRedirectUris();
foreach (var redirect in clientUpdateInput.Client.RedirectUris)
// 删除不存在的uri
client.RedirectUris.RemoveAll(uri => !input.RedirectUris.Contains(uri.RedirectUri));
foreach (var redirect in input.RedirectUris)
{
client.AddRedirectUri(redirect.RedirectUri);
if (client.FindRedirectUri(redirect) != null)
{
client.AddRedirectUri(redirect);
}
}
#endregion
#region AllowedGrantTypes
client.RemoveAllAllowedGrantTypes();
foreach (var grantType in clientUpdateInput.Client.AllowedGrantTypes)
// 删除不存在的验证类型
client.AllowedGrantTypes.RemoveAll(grantType => !input.AllowedGrantTypes.Contains(grantType.GrantType));
foreach (var grantType in input.AllowedGrantTypes)
{
client.AddGrantType(grantType.GrantType);
if (client.FindGrantType(grantType) == null)
{
client.AddGrantType(grantType);
}
}
#endregion
#region AllowedCorsOrigins
client.RemoveAllCorsOrigins();
foreach (var corgOrigin in clientUpdateInput.Client.AllowedCorsOrigins)
// 删除不存在的同源域名
client.AllowedCorsOrigins.RemoveAll(corgOrigin => !input.AllowedCorsOrigins.Contains(corgOrigin.Origin));
foreach (var corgOrigin in input.AllowedCorsOrigins)
{
if (client.FindCorsOrigin(corgOrigin) == null)
{
client.AddCorsOrigin(corgOrigin.Origin);
client.AddCorsOrigin(corgOrigin);
}
}
#endregion
#region PostLogoutRedirectUris
client.RemoveAllPostLogoutRedirectUris();
foreach (var logoutRedirect in clientUpdateInput.Client.PostLogoutRedirectUris)
// 删除不存在的登录重定向域名
client.PostLogoutRedirectUris.RemoveAll(uri => !input.PostLogoutRedirectUris.Contains(uri.PostLogoutRedirectUri));
foreach (var logoutRedirectUri in input.PostLogoutRedirectUris)
{
client.AddPostLogoutRedirectUri(logoutRedirect.PostLogoutRedirectUri);
if (client.FindPostLogoutRedirectUri(logoutRedirectUri) == null)
{
client.AddPostLogoutRedirectUri(logoutRedirectUri);
}
}
#endregion
#region IdentityProviderRestrictions
client.RemoveAllIdentityProviderRestrictions();
foreach (var provider in clientUpdateInput.Client.IdentityProviderRestrictions)
// 删除身份认证限制提供商
client.IdentityProviderRestrictions.RemoveAll(provider => !input.IdentityProviderRestrictions.Contains(provider.Provider));
foreach (var provider in input.IdentityProviderRestrictions)
{
client.AddIdentityProviderRestriction(provider.Provider);
if (client.FindIdentityProviderRestriction(provider) == null)
{
client.AddIdentityProviderRestriction(provider);
}
}
#endregion
client = await ClientRepository.UpdateAsync(client, true);
#region Secrets
var currentSecrets = new List<ClientSecretDto>();
foreach (var inputSecret in input.Secrets)
{
var inputSecretValue = inputSecret.Value;
// 如果是 SharedSecret 类型的密钥
// 采用 IdentityServer4 服务器扩展方法加密
if (IdentityServerConstants.SecretTypes.SharedSecret.Equals(inputSecret.Type))
{
if (inputSecret.HashType == HashType.Sha256)
{
inputSecretValue = inputSecret.Value.Sha256();
}
else if (inputSecret.HashType == HashType.Sha512)
{
inputSecretValue = inputSecret.Value.Sha512();
}
}
else
{
throw new UserFriendlyException(L["EncryptionNotImplemented", inputSecret.Type]);
}
var clientSecret = client.FindSecret(inputSecretValue, inputSecret.Type);
if (clientSecret == null)
{
client.AddSecret(inputSecretValue, inputSecret.Expiration, inputSecret.Type, inputSecret.Description);
currentSecrets.Add(new ClientSecretDto
{
Value = inputSecretValue,
Type = inputSecret.Type
});
}
else
{
currentSecrets.Add(new ClientSecretDto
{
Value = clientSecret.Value,
Type = clientSecret.Type
});
}
}
// 移除已经不存在的客户端密钥
client.ClientSecrets.RemoveAll(secret => !currentSecrets.Any(allowSecret => secret.Value == allowSecret.Value && secret.Type == allowSecret.Type));
#endregion
#region Properties
// 移除不存在的属性
client.Properties.RemoveAll(prop => input.Properties.Any(inputProp => inputProp.Key == prop.Key && inputProp.Value == prop.Value));
foreach (var inputProp in input.Properties)
{
if (client.FindProperty(inputProp.Key, inputProp.Value) == null)
{
client.AddProperty(inputProp.Key, inputProp.Value);
}
}
#endregion
client = await ClientRepository.UpdateAsync(client);
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<Client, ClientDto>(client);
}
@ -283,22 +319,23 @@ namespace LINGYUN.Abp.IdentityServer.Clients
/// 实现参考 Skoruba.IdentityServer4.Admin 项目
/// https://github.com/skoruba/IdentityServer4.Admin.git
/// </remarks>
/// <param name="clientCloneInput"></param>
/// <param name="id"></param>
/// <param name="input"></param>
/// <returns></returns>
[Authorize(AbpIdentityServerPermissions.Clients.Clone)]
public virtual async Task<ClientDto> CloneAsync(ClientCloneInputDto clientCloneInput)
public virtual async Task<ClientDto> CloneAsync(Guid id, ClientCloneDto input)
{
var clientIdExists = await ClientRepository.CheckClientIdExistAsync(clientCloneInput.ClientId);
var clientIdExists = await ClientRepository.CheckClientIdExistAsync(input.ClientId);
if (clientIdExists)
{
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ClientIdExisted, clientCloneInput.ClientId]);
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ClientIdExisted, input.ClientId]);
}
var srcClient = await ClientRepository.GetAsync(clientCloneInput.SourceClientId);
var srcClient = await ClientRepository.GetAsync(id);
var client = new Client(GuidGenerator.Create(), clientCloneInput.ClientId)
var client = new Client(GuidGenerator.Create(), input.ClientId)
{
ClientName = clientCloneInput.ClientName,
Description = clientCloneInput.Description,
ClientName = input.ClientName,
Description = input.Description,
AbsoluteRefreshTokenLifetime = srcClient.AbsoluteRefreshTokenLifetime,
AccessTokenLifetime = srcClient.AccessTokenLifetime,
AccessTokenType = srcClient.AccessTokenType,
@ -338,56 +375,56 @@ namespace LINGYUN.Abp.IdentityServer.Clients
UserSsoLifetime = srcClient.UserSsoLifetime
};
if (clientCloneInput.CopyAllowedCorsOrigin)
if (input.CopyAllowedCorsOrigin)
{
foreach(var corsOrigin in srcClient.AllowedCorsOrigins)
{
client.AddCorsOrigin(corsOrigin.Origin);
}
}
if (clientCloneInput.CopyAllowedGrantType)
if (input.CopyAllowedGrantType)
{
foreach (var grantType in srcClient.AllowedGrantTypes)
{
client.AddGrantType(grantType.GrantType);
}
}
if (clientCloneInput.CopyAllowedScope)
if (input.CopyAllowedScope)
{
foreach (var scope in srcClient.AllowedScopes)
{
client.AddScope(scope.Scope);
}
}
if (clientCloneInput.CopyClaim)
if (input.CopyClaim)
{
foreach (var claim in srcClient.Claims)
{
client.AddClaim(claim.Value, claim.Type);
}
}
if (clientCloneInput.CopyIdentityProviderRestriction)
if (input.CopyIdentityProviderRestriction)
{
foreach (var provider in srcClient.IdentityProviderRestrictions)
{
client.AddIdentityProviderRestriction(provider.Provider);
}
}
if (clientCloneInput.CopyPostLogoutRedirectUri)
if (input.CopyPostLogoutRedirectUri)
{
foreach (var uri in srcClient.PostLogoutRedirectUris)
{
client.AddPostLogoutRedirectUri(uri.PostLogoutRedirectUri);
}
}
if (clientCloneInput.CopyPropertie)
if (input.CopyPropertie)
{
foreach (var property in srcClient.Properties)
{
client.AddProperty(property.Key, property.Value);
}
}
if (clientCloneInput.CopyRedirectUri)
if (input.CopyRedirectUri)
{
foreach (var uri in srcClient.RedirectUris)
{
@ -395,75 +432,10 @@ namespace LINGYUN.Abp.IdentityServer.Clients
}
}
client = await ClientRepository.InsertAsync(client);
return ObjectMapper.Map<Client, ClientDto>(client);
}
[Authorize(AbpIdentityServerPermissions.Clients.Claims.Update)]
public virtual async Task<ClientClaimDto> UpdateClaimAsync(ClientClaimUpdateDto clientClaimUpdate)
{
var client = await ClientRepository.GetAsync(clientClaimUpdate.ClientId);
var clientClaim = client.Claims.FirstOrDefault(claim => claim.Type.Equals(clientClaimUpdate.Type));
if(clientClaim == null)
{
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.ClientClaimNotFound, clientClaimUpdate.Type]);
}
clientClaim.Value = clientClaimUpdate.Value;
return ObjectMapper.Map<ClientClaim, ClientClaimDto>(clientClaim);
}
[Authorize(AbpIdentityServerPermissions.Clients.Properties.Update)]
public virtual async Task<ClientPropertyDto> UpdatePropertyAsync(ClientPropertyUpdateDto clientPropertyUpdate)
{
var client = await ClientRepository.GetAsync(clientPropertyUpdate.ClientId);
var clientProperty = client.Properties
.FirstOrDefault(property => property.Key.Equals(clientPropertyUpdate.Key));
if (clientProperty == null)
{
throw new UserFriendlyException(
L[AbpIdentityServerErrorConsts.ClientPropertyNotFound, clientPropertyUpdate.Key]);
}
clientProperty.Value = clientPropertyUpdate.Value;
return ObjectMapper.Map<ClientProperty, ClientPropertyDto>(clientProperty);
}
[Authorize(AbpIdentityServerPermissions.Clients.Secrets.Update)]
public virtual async Task<ClientSecretDto> UpdateSecretAsync(ClientSecretUpdateDto clientSecretUpdate)
{
var client = await ClientRepository.GetAsync(clientSecretUpdate.ClientId);
var clientSecret = client.ClientSecrets
.FirstOrDefault(secret => secret.Type.Equals(clientSecretUpdate.Type));
if (clientSecret == null)
{
throw new UserFriendlyException(
L[AbpIdentityServerErrorConsts.ClientSecretNotFound, clientSecretUpdate.Type]);
}
var clientSecretValue = clientSecret.Value;
await CurrentUnitOfWork.SaveChangesAsync();
// 如果是 SharedSecret 类型的密钥
// 采用 IdentityServer4 服务器扩展方法加密
if (IdentityServerConstants.SecretTypes.SharedSecret.Equals(clientSecretUpdate.Type))
{
if (clientSecretUpdate.HashType == HashType.Sha256)
{
clientSecretValue = clientSecretUpdate.Value.Sha256();
}
else if (clientSecretUpdate.HashType == HashType.Sha512)
{
clientSecretValue = clientSecretUpdate.Value.Sha512();
}
}
else
{
throw new UserFriendlyException(L["EncryptionNotImplemented", clientSecretUpdate.Type]);
}
clientSecret.Value = clientSecretValue;
return ObjectMapper.Map<ClientSecret, ClientSecretDto>(clientSecret);
return ObjectMapper.Map<Client, ClientDto>(client);
}
}
}

106
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceAppService.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Authorization;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
@ -18,18 +19,18 @@ namespace LINGYUN.Abp.IdentityServer.IdentityResources
IdentityResourceRepository = identityResourceRepository;
}
public virtual async Task<IdentityResourceDto> GetAsync(IdentityResourceGetByIdInputDto identityResourceGetById)
public virtual async Task<IdentityResourceDto> GetAsync(Guid id)
{
var identityResource = await IdentityResourceRepository.GetAsync(identityResourceGetById.Id);
var identityResource = await IdentityResourceRepository.GetAsync(id);
return ObjectMapper.Map<IdentityResource, IdentityResourceDto>(identityResource);
}
public virtual async Task<PagedResultDto<IdentityResourceDto>> GetAsync(IdentityResourceGetByPagedInputDto identityResourceGetByPaged)
public virtual async Task<PagedResultDto<IdentityResourceDto>> GetListAsync(IdentityResourceGetByPagedDto input)
{
var identityResources = await IdentityResourceRepository.GetListAsync(identityResourceGetByPaged.Sorting,
identityResourceGetByPaged.SkipCount, identityResourceGetByPaged.MaxResultCount,
identityResourceGetByPaged.Filter, true);
var identityResources = await IdentityResourceRepository.GetListAsync(input.Sorting,
input.SkipCount, input.MaxResultCount,
input.Filter);
var identityResourceCount = await IdentityResourceRepository.GetCountAsync();
return new PagedResultDto<IdentityResourceDto>(identityResourceCount,
@ -37,86 +38,79 @@ namespace LINGYUN.Abp.IdentityServer.IdentityResources
}
[Authorize(AbpIdentityServerPermissions.IdentityResources.Create)]
public virtual async Task<IdentityResourceDto> CreateAsync(IdentityResourceCreateDto identityResourceCreate)
public virtual async Task<IdentityResourceDto> CreateAsync(IdentityResourceCreateOrUpdateDto input)
{
var identityResourceExists = await IdentityResourceRepository.CheckNameExistAsync(identityResourceCreate.Name);
var identityResourceExists = await IdentityResourceRepository.CheckNameExistAsync(input.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);
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.IdentityResourceNameExisted, input.Name]);
}
var identityResource = new IdentityResource(GuidGenerator.Create(), input.Name, input.DisplayName,
input.Description, input.Enabled, input.Required, input.Emphasize,
input.ShowInDiscoveryDocument);
UpdateApiResourceByInput(identityResource, input);
await CurrentUnitOfWork.SaveChangesAsync();
identityResource = await IdentityResourceRepository.InsertAsync(identityResource);
return ObjectMapper.Map<IdentityResource, IdentityResourceDto>(identityResource);
}
[Authorize(AbpIdentityServerPermissions.IdentityResources.Update)]
public virtual async Task<IdentityResourceDto> UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate)
public virtual async Task<IdentityResourceDto> UpdateAsync(Guid id, IdentityResourceCreateOrUpdateDto input)
{
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);
}
}
var identityResource = await IdentityResourceRepository.GetAsync(id);
UpdateApiResourceByInput(identityResource, input);
identityResource = await IdentityResourceRepository.UpdateAsync(identityResource);
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<IdentityResource, IdentityResourceDto>(identityResource);
}
[Authorize(AbpIdentityServerPermissions.IdentityResources.Delete)]
public virtual async Task DeleteAsync(IdentityResourceGetByIdInputDto identityResourceGetById)
public virtual async Task DeleteAsync(Guid id)
{
await IdentityResourceRepository.DeleteAsync(identityResourceGetById.Id);
await IdentityResourceRepository.DeleteAsync(id);
}
[Authorize(AbpIdentityServerPermissions.IdentityResources.Properties.Create)]
public virtual async Task<IdentityResourcePropertyDto> AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate)
protected virtual void UpdateApiResourceByInput(IdentityResource identityResource, IdentityResourceCreateOrUpdateDto input)
{
var identityResource = await IdentityResourceRepository.GetAsync(identityResourcePropertyCreate.IdentityResourceId);
if (identityResource.Properties.ContainsKey(identityResourcePropertyCreate.Key))
if (!string.Equals(identityResource.Name, input.Name, StringComparison.InvariantCultureIgnoreCase))
{
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.IdentityResourcePropertyExisted, identityResourcePropertyCreate.Key]);
identityResource.Name = input.Name;
}
identityResource.ConcurrencyStamp = identityResourcePropertyCreate.ConcurrencyStamp;
identityResource.Properties.Add(identityResourcePropertyCreate.Key, identityResourcePropertyCreate.Value);
await IdentityResourceRepository.UpdateAsync(identityResource);
return new IdentityResourcePropertyDto
if (!string.Equals(identityResource.Description, input.Description, StringComparison.InvariantCultureIgnoreCase))
{
identityResource.Description = input.Description;
}
if (!string.Equals(identityResource.DisplayName, input.DisplayName, StringComparison.InvariantCultureIgnoreCase))
{
Key = identityResourcePropertyCreate.Key,
Value = identityResourcePropertyCreate.Value
};
identityResource.DisplayName = input.DisplayName;
}
identityResource.Emphasize = input.Emphasize;
identityResource.Enabled = input.Enabled;
identityResource.Required = input.Required;
identityResource.ShowInDiscoveryDocument = input.ShowInDiscoveryDocument;
[Authorize(AbpIdentityServerPermissions.IdentityResources.Properties.Delete)]
public virtual async Task DeletePropertyAsync(IdentityResourcePropertyGetByKeyDto identityResourcePropertyGetByKey)
// 删除不存在的UserClaim
identityResource.UserClaims.RemoveAll(claim => input.UserClaims.Contains(claim.Type));
foreach (var inputClaim in input.UserClaims)
{
var userClaim = identityResource.FindUserClaim(inputClaim);
if (userClaim == null)
{
var identityResource = await IdentityResourceRepository.GetAsync(identityResourcePropertyGetByKey.IdentityResourceId);
identityResource.AddUserClaim(inputClaim);
}
}
if (!identityResource.Properties.ContainsKey(identityResourcePropertyGetByKey.Key))
// 删除不存在的Property
identityResource.Properties.RemoveAll(scope => !input.Properties.ContainsKey(scope.Key));
foreach (var inputProp in input.Properties)
{
throw new UserFriendlyException(L[AbpIdentityServerErrorConsts.IdentityResourcePropertyNotFound, identityResourcePropertyGetByKey.Key]);
identityResource.Properties[inputProp.Key] = inputProp.Value;
}
identityResource.Properties.Remove(identityResourcePropertyGetByKey.Key);
await IdentityResourceRepository.UpdateAsync(identityResource);
}
}
}

58
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/ApiResources/ApiResourceController.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
@ -7,8 +8,8 @@ using Volo.Abp.AspNetCore.Mvc;
namespace LINGYUN.Abp.IdentityServer.ApiResources
{
[RemoteService(Name = AbpIdentityServerConsts.RemoteServiceName)]
[Area("IdentityServer")]
[Route("api/IdentityServer/ApiResources")]
[Area("identity-server")]
[Route("api/identity-server/api-resources")]
public class ApiResourceController : AbpController, IApiResourceAppService
{
protected IApiResourceAppService ApiResourceAppService { get; }
@ -19,63 +20,36 @@ namespace LINGYUN.Abp.IdentityServer.ApiResources
}
[HttpGet]
[Route("{Id}")]
public virtual async Task<ApiResourceDto> GetAsync(ApiResourceGetByIdInputDto apiResourceGetById)
[Route("{id}")]
public virtual async Task<ApiResourceDto> GetAsync(Guid id)
{
return await ApiResourceAppService.GetAsync(apiResourceGetById);
return await ApiResourceAppService.GetAsync(id);
}
[HttpGet]
public virtual async Task<PagedResultDto<ApiResourceDto>> GetAsync(ApiResourceGetByPagedInputDto apiResourceGetByPaged)
public virtual async Task<PagedResultDto<ApiResourceDto>> GetListAsync(ApiResourceGetByPagedInputDto input)
{
return await ApiResourceAppService.GetAsync(apiResourceGetByPaged);
return await ApiResourceAppService.GetListAsync(input);
}
[HttpPost]
public virtual async Task<ApiResourceDto> CreateAsync(ApiResourceCreateDto apiResourceCreate)
public virtual async Task<ApiResourceDto> CreateAsync(ApiResourceCreateDto input)
{
return await ApiResourceAppService.CreateAsync(apiResourceCreate);
return await ApiResourceAppService.CreateAsync(input);
}
[HttpPut]
public virtual async Task<ApiResourceDto> UpdateAsync(ApiResourceUpdateDto apiResourceUpdate)
[Route("{id}")]
public virtual async Task<ApiResourceDto> UpdateAsync(Guid id, ApiResourceUpdateDto input)
{
return await ApiResourceAppService.UpdateAsync(apiResourceUpdate);
return await ApiResourceAppService.UpdateAsync(id, input);
}
[HttpDelete]
[Route("{Id}")]
public virtual async Task DeleteAsync(ApiResourceGetByIdInputDto apiResourceGetById)
[Route("{id}")]
public virtual async Task DeleteAsync(Guid id)
{
await ApiResourceAppService.DeleteAsync(apiResourceGetById);
}
[HttpPost]
[Route("Secrets")]
public virtual async Task<ApiSecretDto> AddSecretAsync(ApiSecretCreateDto apiSecretCreate)
{
return await ApiResourceAppService.AddSecretAsync(apiSecretCreate);
}
[HttpDelete]
[Route("Secrets")]
public virtual async Task DeleteSecretAsync(ApiSecretGetByTypeInputDto apiSecretGetByType)
{
await ApiResourceAppService.DeleteSecretAsync(apiSecretGetByType);
}
[HttpPost]
[Route("Scopes")]
public virtual async Task<ApiScopeDto> AddScopeAsync(ApiScopeCreateDto apiScopeCreate)
{
return await ApiResourceAppService.AddScopeAsync(apiScopeCreate);
}
[HttpDelete]
[Route("Scopes")]
public virtual async Task DeleteScopeAsync(ApiScopeGetByNameInputDto apiScopeGetByName)
{
await ApiResourceAppService.DeleteScopeAsync(apiScopeGetByName);
await ApiResourceAppService.DeleteAsync(id);
}
}
}

99
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/Clients/ClientController.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
@ -7,8 +8,8 @@ using Volo.Abp.AspNetCore.Mvc;
namespace LINGYUN.Abp.IdentityServer.Clients
{
[RemoteService(Name = AbpIdentityServerConsts.RemoteServiceName)]
[Area("IdentityServer")]
[Route("api/IdentityServer/Clients")]
[Area("identity-server")]
[Route("api/identity-server/clients")]
public class ClientController : AbpController, IClientAppService
{
protected IClientAppService ClientAppService { get; }
@ -18,105 +19,43 @@ namespace LINGYUN.Abp.IdentityServer.Clients
}
[HttpPost]
public virtual async Task<ClientDto> CreateAsync(ClientCreateDto clientCreate)
public virtual async Task<ClientDto> CreateAsync(ClientCreateDto input)
{
return await ClientAppService.CreateAsync(clientCreate);
return await ClientAppService.CreateAsync(input);
}
[HttpDelete]
[Route("{Id}")]
public virtual async Task DeleteAsync(ClientGetByIdInputDto clientGetByIdInput)
[Route("{id}")]
public virtual async Task DeleteAsync(Guid id)
{
await ClientAppService.DeleteAsync(clientGetByIdInput);
await ClientAppService.DeleteAsync(id);
}
[HttpGet]
[Route("{Id}")]
public virtual async Task<ClientDto> GetAsync(ClientGetByIdInputDto clientGetById)
[Route("{id}")]
public virtual async Task<ClientDto> GetAsync(Guid id)
{
return await ClientAppService.GetAsync(clientGetById);
return await ClientAppService.GetAsync(id);
}
[HttpGet]
public virtual async Task<PagedResultDto<ClientDto>> GetAsync(ClientGetByPagedInputDto clientGetByPaged)
public virtual async Task<PagedResultDto<ClientDto>> GetListAsync(ClientGetByPagedDto input)
{
return await ClientAppService.GetAsync(clientGetByPaged);
return await ClientAppService.GetListAsync(input);
}
[HttpPut]
public virtual async Task<ClientDto> UpdateAsync(ClientUpdateInputDto clientUpdateInput)
[Route("{id}")]
public virtual async Task<ClientDto> UpdateAsync(Guid id, ClientUpdateDto input)
{
return await ClientAppService.UpdateAsync(clientUpdateInput);
return await ClientAppService.UpdateAsync(id, input);
}
[HttpPost]
[Route("Clone")]
public virtual async Task<ClientDto> CloneAsync(ClientCloneInputDto clientCloneInput)
[Route("{id}/clone")]
public virtual async Task<ClientDto> CloneAsync(Guid id, ClientCloneDto input)
{
return await ClientAppService.CloneAsync(clientCloneInput);
}
[HttpPost]
[Route("Claims")]
public virtual async Task<ClientClaimDto> AddClaimAsync(ClientClaimCreateDto clientClaimCreate)
{
return await ClientAppService.AddClaimAsync(clientClaimCreate);
}
[HttpPut]
[Route("Claims")]
public virtual async Task<ClientClaimDto> UpdateClaimAsync(ClientClaimUpdateDto clientClaimUpdate)
{
return await ClientAppService.UpdateClaimAsync(clientClaimUpdate);
}
[HttpDelete]
[Route("Claims")]
public virtual async Task DeleteClaimAsync(ClientClaimGetByKeyInputDto clientClaimGetByKey)
{
await ClientAppService.DeleteClaimAsync(clientClaimGetByKey);
}
[HttpPost]
[Route("Properties")]
public virtual async Task<ClientPropertyDto> AddPropertyAsync(ClientPropertyCreateDto clientPropertyCreate)
{
return await ClientAppService.AddPropertyAsync(clientPropertyCreate);
}
[HttpPut]
[Route("Properties")]
public virtual async Task<ClientPropertyDto> UpdatePropertyAsync(ClientPropertyUpdateDto clientPropertyUpdate)
{
return await ClientAppService.UpdatePropertyAsync(clientPropertyUpdate);
}
[HttpDelete]
[Route("Properties")]
public virtual async Task DeletePropertyAsync(ClientPropertyGetByKeyDto clientPropertyGetByKey)
{
await ClientAppService.DeletePropertyAsync(clientPropertyGetByKey);
}
[HttpPost]
[Route("Secrets")]
public virtual async Task<ClientSecretDto> AddSecretAsync(ClientSecretCreateDto clientSecretCreate)
{
return await ClientAppService.AddSecretAsync(clientSecretCreate);
}
[HttpDelete]
[Route("Secrets")]
public virtual async Task DeleteSecretAsync(ClientSecretGetByTypeDto clientSecretGetByType)
{
await ClientAppService.DeleteSecretAsync(clientSecretGetByType);
}
[HttpPut]
[Route("Secrets")]
public virtual async Task<ClientSecretDto> UpdateSecretAsync(ClientSecretUpdateDto clientSecretUpdate)
{
return await ClientAppService.UpdateSecretAsync(clientSecretUpdate);
return await ClientAppService.CloneAsync(id, input);
}
}
}

43
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.HttpApi/LINGYUN/Abp/IdentityServer/IdentityResources/IdentityResourceController.cs

@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
@ -7,8 +8,8 @@ using Volo.Abp.AspNetCore.Mvc;
namespace LINGYUN.Abp.IdentityServer.IdentityResources
{
[RemoteService(Name = AbpIdentityServerConsts.RemoteServiceName)]
[Area("IdentityServer")]
[Route("api/IdentityServer/IdentityResources")]
[Area("identity-server")]
[Route("api/identity-server/identity-resources")]
public class IdentityResourceController : AbpController, IIdentityResourceAppService
{
protected IIdentityResourceAppService IdentityResourceAppService { get; }
@ -19,48 +20,36 @@ namespace LINGYUN.Abp.IdentityServer.IdentityResources
}
[HttpGet]
[Route("{Id}")]
public virtual async Task<IdentityResourceDto> GetAsync(IdentityResourceGetByIdInputDto identityResourceGetById)
[Route("{id}")]
public virtual async Task<IdentityResourceDto> GetAsync(Guid id)
{
return await IdentityResourceAppService.GetAsync(identityResourceGetById);
return await IdentityResourceAppService.GetAsync(id);
}
[HttpGet]
public virtual async Task<PagedResultDto<IdentityResourceDto>> GetAsync(IdentityResourceGetByPagedInputDto identityResourceGetByPaged)
public virtual async Task<PagedResultDto<IdentityResourceDto>> GetListAsync(IdentityResourceGetByPagedDto input)
{
return await IdentityResourceAppService.GetAsync(identityResourceGetByPaged);
return await IdentityResourceAppService.GetListAsync(input);
}
[HttpPost]
public virtual async Task<IdentityResourceDto> CreateAsync(IdentityResourceCreateDto identityResourceCreate)
public virtual async Task<IdentityResourceDto> CreateAsync(IdentityResourceCreateOrUpdateDto input)
{
return await IdentityResourceAppService.CreateAsync(identityResourceCreate);
return await IdentityResourceAppService.CreateAsync(input);
}
[HttpPut]
public virtual async Task<IdentityResourceDto> UpdateAsync(IdentityResourceUpdateDto identityResourceUpdate)
[Route("{id}")]
public virtual async Task<IdentityResourceDto> UpdateAsync(Guid id, IdentityResourceCreateOrUpdateDto input)
{
return await IdentityResourceAppService.UpdateAsync(identityResourceUpdate);
return await IdentityResourceAppService.UpdateAsync(id, input);
}
[HttpDelete]
public virtual async Task DeleteAsync(IdentityResourceGetByIdInputDto identityResourceGetById)
[Route("{id}")]
public virtual async Task DeleteAsync(Guid id)
{
await IdentityResourceAppService.DeleteAsync(identityResourceGetById);
}
[HttpPost]
[Route("Properties")]
public virtual async Task<IdentityResourcePropertyDto> AddPropertyAsync(IdentityResourcePropertyCreateDto identityResourcePropertyCreate)
{
return await IdentityResourceAppService.AddPropertyAsync(identityResourcePropertyCreate);
}
[HttpDelete]
[Route("Properties")]
public virtual async Task DeletePropertyAsync(IdentityResourcePropertyGetByKeyDto identityResourcePropertyGetByKey)
{
await IdentityResourceAppService.DeletePropertyAsync(identityResourcePropertyGetByKey);
await IdentityResourceAppService.DeleteAsync(id);
}
}
}

BIN
aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/event-bus-cap.db

Binary file not shown.

105
vueJs/src/api/api-resources.ts

@ -0,0 +1,105 @@
import ApiService from './serviceBase'
import { FullAuditedEntityDto, PagedAndSortedResultRequestDto, PagedResultDto, SecretBase } from './types'
const sourceUrl = '/api/identity-server/api-resources'
const serviceUrl = process.env.VUE_APP_BASE_API
export default class ApiResourceService {
/**
* Api资源
* @param id Api资源标识
*/
public static getApiResourceById(id: string) {
const _url = sourceUrl + '/' + id
return ApiService.Get<ApiResource>(_url, serviceUrl)
}
/**
* Api资源列表
* @param payload
*/
public static getApiResources(payload: ApiResourceGetByPaged) {
let _url = sourceUrl + '?filter=' + payload.filter
_url += '&sorting=' + payload.sorting
_url += '&skipCount=' + payload.skipCount
_url += '&maxResultCount=' + payload.maxResultCount
return ApiService.Get<PagedResultDto<ApiResource>>(_url, serviceUrl)
}
/**
* Api资源
* @param payload api资源参数
*/
public static createApiResource(payload: ApiResourceCreate) {
return ApiService.Post<ApiResource>(sourceUrl, payload, serviceUrl)
}
/**
* Api资源
* @param payload api资源参数
*/
public static updateApiResource(id: string, payload: ApiResourceUpdate) {
const _url = sourceUrl + '/' + id
return ApiService.Put<ApiResource>(_url, payload, serviceUrl)
}
/**
* Api资源
* @param id Api资源标识
*/
public static deleteApiResource(id: string) {
const _url = sourceUrl + '/' + id
return ApiService.Delete(_url, serviceUrl)
}
}
export enum HashType {
Sha256,
Sha512
}
export class ApiScope {
name = ''
displayName?: string = ''
description?: string = ''
required = false
emphasize = false
showInDiscoveryDocument = true
userClaims = new Array<string>()
}
export class ApiSecret extends SecretBase {}
export class ApiSecretCreateOrUpdate extends SecretBase {
hashType = HashType.Sha256
}
export class ApiResourceCreateOrUpdate {
displayName?: string = ''
description?: string = ''
enabled = true
userClaims = new Array<string>()
scopes = new Array<ApiScope>()
secrets = new Array<ApiSecretCreateOrUpdate>()
}
export class ApiResourceCreate extends ApiResourceCreateOrUpdate {
name = ''
}
export class ApiResourceUpdate extends ApiResourceCreateOrUpdate {}
export class ApiResource extends FullAuditedEntityDto {
id!: string
name!: string
displayName?: string
description?: string
enabled!: boolean
userClaims = new Array<string>()
scopes = new Array<ApiScope>()
secrets = new Array<ApiSecretCreateOrUpdate>()
}
export class ApiResourceGetByPaged extends PagedAndSortedResultRequestDto {
filter = ''
}

279
vueJs/src/api/apiresources.ts

@ -1,279 +0,0 @@
import ApiService from './serviceBase'
import { FullAuditedEntityDto, PagedAndSortedResultRequestDto, PagedResultDto } from './types'
const serviceUrl = process.env.VUE_APP_BASE_API
export default class ApiResourceService {
/**
* Api资源
* @param id Api资源标识
*/
public static getApiResourceById(id: string) {
let _url = '/api/IdentityServer/ApiResources/'
_url += id
return ApiService.Get<ApiResource>(_url, serviceUrl)
}
/**
* Api资源列表
* @param payload
*/
public static getApiResources(payload: ApiResourceGetByPaged) {
let _url = '/api/IdentityServer/ApiResources'
_url += '?filter=' + payload.filter
_url += '&sorting=' + payload.sorting
_url += '&skipCount=' + payload.skipCount
_url += '&maxResultCount=' + payload.maxResultCount
return ApiService.Get<PagedResultDto<ApiResource>>(_url, serviceUrl)
}
/**
* Api资源
* @param payload api资源参数
*/
public static createApiResource(payload: ApiResourceCreate) {
const _url = '/api/IdentityServer/ApiResources'
return ApiService.Post<ApiResource>(_url, payload, serviceUrl)
}
/**
* Api资源
* @param payload api资源参数
*/
public static updateApiResource(payload: ApiResourceUpdate) {
const _url = '/api/IdentityServer/ApiResources'
return ApiService.Put<ApiResource>(_url, payload, serviceUrl)
}
/**
* Api资源
* @param id Api资源标识
*/
public static deleteApiResource(id: string) {
let _url = '/api/IdentityServer/ApiResources/'
_url += id
return ApiService.Delete(_url, serviceUrl)
}
/**
* Api密钥
* @param payload Api密钥参数
*/
public static addApiSecret(payload: ApiSecretCreate) {
const _url = '/api/IdentityServer/ApiResources/Secrets'
return ApiService.Post<ApiSecret>(_url, payload, serviceUrl)
}
/**
* Api密钥
* @param apiResourceId
* @param type
* @param value
*/
public static deleteApiSecret(apiResourceId: string, type: string, value: string) {
let _url = '/api/IdentityServer/ApiResources/Secrets/'
_url += '?apiResourceId=' + apiResourceId
_url += '&type=' + type
_url += '&value=' + value
return ApiService.Delete(_url, serviceUrl)
}
/**
* Api授权范围
* @param payload api授权范围参数
*/
public static addApiScope(payload: ApiScopeCreate) {
const _url = '/api/IdentityServer/ApiResources/Scopes'
return ApiService.Post<ApiScope>(_url, payload, serviceUrl)
}
/**
* Api授权范围
* @param apiResourceId api资源标识
* @param name
*/
public static deleteApiScope(apiResourceId: string, name: string) {
let _url = '/api/IdentityServer/ApiResources/Scopes'
_url += '?apiResourceId=' + apiResourceId
_url += '&name=' + name
return ApiService.Delete(_url, serviceUrl)
}
}
export enum HashType {
Sha256,
Sha512
}
export class ApiSecret {
type!: string
value!: string
hashType?: HashType
description?: string
expiration?: Date
}
export class ApiScopeClaim {
type!: string
}
export class ApiResourceClaim {
type!: string
}
export class ApiScope {
name!: string
displayName?: string
description?: string
required!: boolean
emphasize!: boolean
showInDiscoveryDocument!: boolean
userClaims: ApiScopeClaim[]
constructor() {
this.userClaims = new Array<ApiScopeClaim>()
}
}
export class ApiScopeCreate {
apiResourceId!: string
name!: string
displayName?: string
description?: string
required!: boolean
emphasize!: boolean
showInDiscoveryDocument!: boolean
userClaims: ApiScopeClaim[]
constructor() {
this.apiResourceId = ''
this.name = ''
this.displayName = ''
this.description = ''
this.required = false
this.emphasize = false
this.showInDiscoveryDocument = false
this.userClaims = new Array<ApiScopeClaim>()
}
public static empty() {
return new ApiScopeCreate()
}
}
export class ApiSecretCreate {
apiResourceId!: string
type!: string
value!: string
hashType?: HashType
description?: string
expiration?: Date
constructor() {
this.type = 'SharedSecret'
this.value = ''
this.hashType = HashType.Sha256
this.description = ''
this.expiration = undefined
}
public static empty() {
return new ApiSecretCreate()
}
}
export class ApiResourceCreate {
name!: string
displayName?: string
description?: string
enabled!: boolean
userClaims!: ApiResourceClaim[]
constructor() {
this.name = ''
this.displayName = ''
this.description = ''
this.enabled = true
this.userClaims = new Array<ApiResourceClaim>()
}
public static empty() {
return new ApiResourceCreate()
}
public static create(apiResource: ApiResource) {
const resource = ApiResourceCreate.empty()
resource.name = apiResource.name
resource.displayName = apiResource.displayName
resource.description = apiResource.description
resource.enabled = apiResource.enabled
resource.userClaims = apiResource.userClaims
return resource
}
}
export class ApiResourceUpdate {
id!: string
displayName?: string
description?: string
enabled!: boolean
userClaims!: ApiResourceClaim[]
constructor() {
this.id = ''
this.displayName = ''
this.description = ''
this.enabled = true
this.userClaims = new Array<ApiResourceClaim>()
}
public static empty() {
return new ApiResourceUpdate()
}
public static create(apiResource: ApiResource) {
const resource = ApiResourceUpdate.empty()
resource.id = apiResource.id
resource.displayName = apiResource.displayName
resource.description = apiResource.description
resource.enabled = apiResource.enabled
resource.userClaims = apiResource.userClaims
return resource
}
}
export class ApiResource extends FullAuditedEntityDto {
id!: string
name!: string
displayName?: string
description?: string
enabled!: boolean
secrets!: ApiSecret[]
scopes!: ApiScope[]
userClaims!: ApiResourceClaim[]
constructor() {
super()
this.id = ''
this.name = ''
this.displayName = ''
this.description = ''
this.enabled = true
this.scopes = new Array<ApiScope>()
this.secrets = new Array<ApiSecret>()
this.userClaims = new Array<ApiResourceClaim>()
}
public static empty() {
return new ApiResource()
}
}
export class ApiResourceGetByPaged extends PagedAndSortedResultRequestDto {
filter!: string
constructor() {
super()
this.filter = ''
}
}

39
vueJs/src/api/identityresources.ts → vueJs/src/api/identity-resources.ts

@ -1,6 +1,7 @@
import ApiService from './serviceBase'
import { FullAuditedEntityDto, PagedResultDto, PagedAndSortedResultRequestDto } from './types'
const sourceUrl = '/api/identity-server/identity-resources'
/** 远程服务地址 */
const serviceUrl = process.env.VUE_APP_BASE_API
@ -12,8 +13,7 @@ export default class IdentityResourceService {
* @returns IdentityResource
*/
public static getIdentityResourceById(id: string) {
let _url = '/api/IdentityServer/IdentityResources/'
_url += id
const _url = sourceUrl + '/' + id
return ApiService.Get<IdentityResource>(_url, serviceUrl)
}
@ -23,8 +23,7 @@ export default class IdentityResourceService {
* @returns IdentityResource
*/
public static getIdentityResources(payload: IdentityResourceGetByPaged) {
let _url = '/api/IdentityServer/IdentityResources'
_url += '?filter=' + payload.filter
let _url = sourceUrl + '?filter=' + payload.filter
_url += '&sorting=' + payload.sorting
_url += '&skipCount=' + payload.skipCount
_url += '&maxResultCount=' + payload.maxResultCount
@ -37,8 +36,7 @@ export default class IdentityResourceService {
* @returns IdentityResource
*/
public static createIdentityResource(payload: IdentityResourceCreate) {
const _url = '/api/IdentityServer/IdentityResources'
return ApiService.Post<IdentityResource>(_url, payload, serviceUrl)
return ApiService.Post<IdentityResource>(sourceUrl, payload, serviceUrl)
}
/**
@ -46,8 +44,8 @@ export default class IdentityResourceService {
* @param payload IdentityResourceUpdate
* @returns IdentityResource
*/
public static updateIdentityResource(payload: IdentityResourceUpdate) {
const _url = '/api/IdentityServer/IdentityResources'
public static updateIdentityResource(id: string, payload: IdentityResourceUpdate) {
const _url = sourceUrl + '/' + id
return ApiService.Put<IdentityResource>(_url, payload, serviceUrl)
}
@ -56,30 +54,7 @@ export default class IdentityResourceService {
* @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<IdentityProperty>(_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
const _url = sourceUrl + '/' + id
return ApiService.Delete(_url, serviceUrl)
}
}

20
vueJs/src/api/types.ts

@ -251,3 +251,23 @@ export interface IClaim {
/** 数值 */
value: string
}
export class SecretBase implements ISecret {
type = ''
value = ''
description = ''
expiration: Date | undefined
}
export class Claim implements IClaim {
type!: string
value!: string
constructor(
type: string,
value: string
) {
this.type = type
this.value = value
}
}

201
vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceCreateOrEditForm.vue

@ -16,10 +16,18 @@
label-width="100px"
:model="apiResource"
:rules="apiResourceRules"
>
<el-tabs
v-model="activeTable"
type="border-card"
>
<el-tab-pane
name="infomation"
:label="$t('AbpIdentityServer.Information')"
>
<el-form-item
prop="enabled"
:label="$t('identityServer.enabledResource')"
:label="$t('AbpIdentityServer.Resource:Enabled')"
>
<el-switch
v-model="apiResource.enabled"
@ -27,17 +35,17 @@
</el-form-item>
<el-form-item
prop="name"
:label="$t('identityServer.resourceName')"
:label="$t('AbpIdentityServer.Name')"
>
<el-input
v-model="apiResource.name"
:readonly="isEdit"
:placeholder="$t('pleaseInputBy', {key: $t('identityServer.resourceName')})"
:placeholder="$t('pleaseInputBy', {key: $t('AbpIdentityServer.Name')})"
/>
</el-form-item>
<el-form-item
prop="displayName"
:label="$t('identityServer.resourceDisplayName')"
:label="$t('AbpIdentityServer.DisplayName')"
>
<el-input
v-model="apiResource.displayName"
@ -45,21 +53,54 @@
</el-form-item>
<el-form-item
prop="description"
:label="$t('identityServer.resourceDescription')"
:label="$t('AbpIdentityServer.Description')"
>
<el-input
v-model="apiResource.description"
/>
</el-form-item>
<el-form-item
prop="userClaims"
:label="$t('identityServer.resourceUserClaims')"
</el-tab-pane>
<el-tab-pane
name="userClaim"
:label="$t('AbpIdentityServer.UserClaim')"
>
<el-input-tag-ex
<el-transfer
v-model="apiResource.userClaims"
label="type"
class="transfer-scope"
:data="apiResourceClaims"
:props="{
key: 'type',
label: 'value'
}"
:titles="[$t('AbpIdentityServer.NoClaim'), $t('AbpIdentityServer.ExistsClaim')]"
/>
</el-form-item>
</el-tab-pane>
<el-tab-pane
v-if="isEdit"
name="scopes"
:label="$t('AbpIdentityServer.Scope')"
>
<api-resource-scope-edit-form
:user-claims="apiResourceClaims"
:api-resource-scopes="apiResource.scopes"
@apiResourceScopeCreated="apiResourceScopeCreated"
@apiResourceScopeDeleted="apiResourceScopeDeleted"
/>
</el-tab-pane>
<el-tab-pane
v-if="isEdit"
name="secrets"
:label="$t('AbpIdentityServer.Secret')"
>
<el-card>
<api-resource-secret-edit-form
:api-resource-secrets="apiResource.secrets"
@apiResourceSecretCreated="apiResourceSecretCreated"
@apiResourceSecretDeleted="apiResourceSecretDeleted"
/>
</el-card>
</el-tab-pane>
</el-tabs>
<el-form-item>
<el-button
@ -84,14 +125,39 @@
</template>
<script lang="ts">
import ApiResourceService, { ApiResourceCreate, ApiResourceUpdate, ApiResource } from '@/api/apiresources'
import ApiResourceService, {
ApiScope,
ApiResource,
ApiResourceCreate,
ApiResourceUpdate,
ApiSecretCreateOrUpdate,
ApiResourceCreateOrUpdate, HashType
} from '@/api/api-resources'
import { Component, Prop, Vue, Watch } from 'vue-property-decorator'
import ElInputTagEx from '@/components/InputTagEx/index.vue'
import ClaimTypeApiService from '@/api/cliam-type'
import { checkPermission } from '@/utils/permission'
import { dateFormat } from '@/utils/index'
import { Claim } from '@/api/types'
import ApiResourceSecretEditForm from './ApiResourceSecretEditForm.vue'
import ApiResourceScopeEditForm from './ApiResourceScopeEditForm.vue'
@Component({
name: 'ApiResourceCreateOrEditForm',
components: {
ElInputTagEx
ApiResourceScopeEditForm,
ApiResourceSecretEditForm
},
filters: {
dateTimeFilter(datetime: string) {
if (datetime) {
const date = new Date(datetime)
return dateFormat(date, 'YYYY-mm-dd HH:MM:SS')
}
return ''
}
},
methods: {
checkPermission
}
})
export default class extends Vue {
@ -104,53 +170,109 @@ export default class extends Vue {
@Prop({ default: '' })
private apiResourceId!: string
private apiResource: ApiResource
private activeTable = 'infomation'
private apiResource = new ApiResource()
private apiResourceClaims = new Array<Claim>()
private newApiSecret = new ApiSecretCreateOrUpdate()
private apiResourceRules = {
name: [
{ required: true, message: this.l('pleaseInputBy', { key: this.l('identityServer.resourceName') }), trigger: 'blur' }
{ required: true, message: this.l('pleaseInputBy', { key: this.l('AbpIdentityServer.Name') }), trigger: 'blur' }
]
}
get isEdit() {
if (this.apiResource.id) {
if (this.apiResourceId) {
return true
}
return false
}
constructor() {
super()
this.apiResource = ApiResource.empty()
@Watch('apiResourceId')
private onApiResourceIdChanged() {
this.handleGetApiResource()
}
@Watch('apiResourceId', { immediate: true })
private onApiResourceIdChanged() {
if (this.apiResourceId) {
ApiResourceService.getApiResourceById(this.apiResourceId).then(resource => {
this.apiResource = resource
@Watch('showDialog', { immediate: true })
private onShowDialogChanged() {
this.handleGetApiResource()
}
mounted() {
this.handleGetClaimTypes()
}
private handleGetClaimTypes() {
ClaimTypeApiService.getActivedClaimTypes().then(res => {
res.items.map(claim => {
this.apiResourceClaims.push(new Claim(claim.name, claim.name))
})
})
}
private handleGetApiResource() {
this.activeTable = 'infomation'
if (this.apiResourceId && this.showDialog) {
ApiResourceService.getApiResourceById(this.apiResourceId).then(res => {
this.apiResource = res
})
} else {
this.apiResource = ApiResource.empty()
this.apiResource = new ApiResource()
}
}
private apiResourceSecretCreated(hashType: HashType, type: string, value: string, description: string, expiration: Date | undefined) {
const apiSecret = new ApiSecretCreateOrUpdate()
apiSecret.hashType = hashType
apiSecret.type = type
apiSecret.value = value
apiSecret.description = description
apiSecret.expiration = expiration
this.apiResource.secrets.push(apiSecret)
}
private apiResourceSecretDeleted(type: string, value: string) {
const secretIndex = this.apiResource.secrets.findIndex(secret => secret.type === type && secret.value === value)
this.apiResource.secrets.splice(secretIndex, 1)
}
private apiResourceScopeCreated(name: string, required: boolean, emphasize: boolean, showInDiscoveryDocument: boolean,
userClaims: string[], displayName?: string, description?: string) {
const apiScope = new ApiScope()
apiScope.name = name
apiScope.displayName = displayName
apiScope.description = description
apiScope.required = required
apiScope.emphasize = emphasize
apiScope.showInDiscoveryDocument = showInDiscoveryDocument
apiScope.userClaims = userClaims
this.apiResource.scopes.push(apiScope)
}
private apiResourceScopeDeleted(name: string) {
const scopeIndex = this.apiResource.scopes.findIndex(scope => scope.name === name)
this.apiResource.scopes.splice(scopeIndex, 1)
}
private onSaveApiResource() {
const frmApiResource = this.$refs.formApiResource as any
frmApiResource.validate((valid: boolean) => {
if (valid) {
if (this.isEdit) {
const updateApiResource = ApiResourceUpdate.create(this.apiResource)
ApiResourceService.updateApiResource(updateApiResource).then(resource => {
const updateApiResource = new ApiResourceUpdate()
this.updateApiResourceByInput(updateApiResource)
ApiResourceService.updateApiResource(this.apiResourceId, updateApiResource).then(resource => {
this.apiResource = resource
const successMessage = this.l('identityServer.updateApiResourceSuccess', { name: resource.name })
const successMessage = this.l('global.successful')
this.$message.success(successMessage)
this.onFormClosed(true)
})
} else {
const createApiResource = ApiResourceCreate.create(this.apiResource)
const createApiResource = new ApiResourceCreate()
this.updateApiResourceByInput(createApiResource)
createApiResource.name = this.apiResource.name
ApiResourceService.createApiResource(createApiResource).then(resource => {
this.apiResource = resource
const successMessage = this.l('identityServer.createApiResourceSuccess', { name: resource.name })
const successMessage = this.l('global.successful')
this.$message.success(successMessage)
this.onFormClosed(true)
})
@ -159,6 +281,15 @@ export default class extends Vue {
})
}
private updateApiResourceByInput(apiResource: ApiResourceCreateOrUpdate) {
apiResource.displayName = this.apiResource.displayName
apiResource.description = this.apiResource.description
apiResource.enabled = this.apiResource.enabled
apiResource.userClaims = this.apiResource.userClaims
apiResource.scopes = this.apiResource.scopes
apiResource.secrets = this.apiResource.secrets
}
private onFormClosed(changed: boolean) {
this.resetFields()
this.$emit('closed', changed)
@ -183,9 +314,17 @@ export default class extends Vue {
.confirm {
position: absolute;
right: 10px;
top: 20px;
}
.cancel {
position: absolute;
right: 120px;
top: 20px;
}
.full-select {
width: 100%;
}
.transfer-scope ::v-deep .el-transfer-panel{
width: 250px;
}
</style>

323
vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceScopeEditForm.vue

@ -1,166 +1,186 @@
<template>
<el-dialog
v-el-draggable-dialog
width="800px"
:visible="showDialog"
:title="$t('identityServer.apiResourceScope')"
custom-class="modal-form"
:show-close="false"
@close="onFormClosed"
>
<div class="app-container">
<div>
<el-form
v-if="checkPermission(['IdentityServer.ApiResources.Secrets.Create'])"
ref="formApiScope"
label-width="120px"
:model="apiScope"
:rules="apiScopeRules"
ref="apiResourceScopeEditForm"
label-width="80px"
:model="apiResourceScope"
:rules="apiResourceScopeRules"
>
<el-tabs
type="border-card"
style="width: 100%;"
>
<el-tab-pane :label="$t('AbpIdentityServer.Information')">
<el-row>
<el-col :span="12">
<el-form-item
prop="name"
:label="$t('identityServer.apiScopeName')"
:label="$t('AbpIdentityServer.Name')"
>
<el-input
v-model="apiScope.name"
:placeholder="$t('pleaseInputBy', {key: $t('identityServer.apiScopeName')})"
/>
<el-input v-model="apiResourceScope.name" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
prop="displayName"
:label="$t('identityServer.apiScopeDisplayName')"
:label="$t('AbpIdentityServer.DisplayName')"
>
<el-input
v-model="apiScope.displayName"
/>
<el-input v-model="apiResourceScope.displayName" />
</el-form-item>
</el-col>
</el-row>
<el-form-item
prop="description"
:label="$t('identityServer.apiScopeDescription')"
:label="$t('AbpIdentityServer.Description')"
>
<el-input
v-model="apiScope.description"
/>
<el-input v-model="apiResourceScope.description" />
</el-form-item>
<el-row>
<el-col :span="6">
<el-form-item
prop="required"
:label="$t('identityServer.apiScopeRequired')"
:label="$t('AbpIdentityServer.Required')"
>
<el-switch
v-model="apiScope.required"
/>
<el-switch v-model="apiResourceScope.required" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
prop="emphasize"
:label="$t('identityServer.apiScopeEmphasize')"
:label="$t('AbpIdentityServer.Emphasize')"
>
<el-switch
v-model="apiScope.emphasize"
/>
<el-switch v-model="apiResourceScope.emphasize" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
prop="showInDiscoveryDocument"
:label="$t('identityServer.apiScopeShowInDiscoveryDocument')"
:label="$t('AbpIdentityServer.ShowInDiscoveryDocument')"
label-width="150px"
>
<el-switch
v-model="apiScope.showInDiscoveryDocument"
/>
<el-switch v-model="apiResourceScope.showInDiscoveryDocument" />
</el-form-item>
<el-form-item
prop="userClaims"
:label="$t('identityServer.resourceUserClaims')"
>
<el-input-tag-ex
v-model="apiScope.userClaims"
label="type"
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane :label="$t('AbpIdentityServer.UserClaim')">
<el-transfer
v-model="apiResourceScope.userClaims"
class="transfer-scope-new"
:data="userClaims"
:props="{
key: 'type',
label: 'value'
}"
:titles="[$t('AbpIdentityServer.NoClaim'), $t('AbpIdentityServer.ExistsClaim')]"
/>
</el-form-item>
</el-tab-pane>
</el-tabs>
<el-form-item
style="text-align: center;"
label-width="0px"
>
<el-button
type="primary"
style="width:180px"
@click="onSaveApiScope"
style="width:180px; margin-top: 20px;"
@click="onSave"
>
{{ $t('identityServer.createApiScope') }}
{{ $t('AbpIdentityServer.Scope:New') }}
</el-button>
</el-form-item>
<el-divider />
</el-form>
</div>
<el-table
row-key="value"
:data="apiScopes"
border
fit
highlight-current-row
style="width: 100%;"
>
<el-table-column
:label="$t('identityServer.apiScopeName')"
prop="name"
sortable
width="150px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.name }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('identityServer.apiScopeDisplayName')"
prop="displayName"
sortable
width="200px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.displayName }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('identityServer.apiScopeDescription')"
prop="description"
width="300px"
align="center"
>
<template slot-scope="{row}">
<span>{{ row.description }}</span>
</template>
</el-table-column>
<el-table-column
:label="$t('operaActions')"
align="center"
width="150px"
fixed="right"
<el-collapse accordion>
<el-collapse-item
v-for="(scope, index) in apiResourceScopes"
:key="index"
>
<h3 slot="title">
{{ scope.name }}
</h3>
<el-card>
<el-form
:model="scope"
label-width="80px"
>
<template slot-scope="{row}">
<el-button
:disabled="!checkPermission(['IdentityServer.ApiResources.Scope.Delete'])"
type="danger"
icon="el-icon-delete"
size="mini"
type="primary"
@click="handleDeleteApiScope(row.name)"
style="margin-bottom: 10px;"
@click="handleDeleteApiScope(scope.name)"
>
{{ $t('identityServer.deleteApiScope') }}
{{ $t('AbpIdentityServer.Scope:Delete') }}
</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<el-tabs type="border-card">
<el-tab-pane :label="$t('AbpIdentityServer.Information')">
<el-row>
<el-col :span="12">
<el-form-item :label="$t('AbpIdentityServer.Name')">
<el-input v-model="scope.name" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item :label="$t('AbpIdentityServer.DisplayName')">
<el-input v-model="scope.displayName" />
</el-form-item>
</el-col>
</el-row>
<el-form-item :label="$t('AbpIdentityServer.Description')">
<el-input v-model="scope.description" />
</el-form-item>
<el-row>
<el-col :span="6">
<el-form-item :label="$t('AbpIdentityServer.Required')">
<el-switch v-model="scope.required" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item :label="$t('AbpIdentityServer.Emphasize')">
<el-switch v-model="scope.emphasize" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
:label="$t('AbpIdentityServer.ShowInDiscoveryDocument')"
label-width="150px"
>
<el-switch v-model="scope.showInDiscoveryDocument" />
</el-form-item>
</el-col>
</el-row>
</el-tab-pane>
<el-tab-pane :label="$t('AbpIdentityServer.UserClaim')">
<el-transfer
v-model="scope.userClaims"
class="transfer-scope-edit"
:data="userClaims"
:props="{
key: 'type',
label: 'value'
}"
:titles="[$t('AbpIdentityServer.NoClaim'), $t('AbpIdentityServer.ExistsClaim')]"
/>
</el-tab-pane>
</el-tabs>
</el-form>
</el-card>
</el-collapse-item>
</el-collapse>
</div>
</template>
<script lang="ts">
import ApiResourceService, { ApiScope, ApiScopeCreate } from '@/api/apiresources'
import { Component, Vue, Prop, Watch } from 'vue-property-decorator'
import { ApiScope } from '@/api/api-resources'
import { Component, Vue, Prop } from 'vue-property-decorator'
import { dateFormat } from '@/utils/index'
import { checkPermission } from '@/utils/permission'
import ElInputTagEx from '@/components/InputTagEx/index.vue'
import { Claim } from '@/api/types'
import { Form } from 'element-ui'
@Component({
name: 'ApiScopeEditForm',
name: 'ApiResourceScopeEditForm',
components: {
ElInputTagEx
},
@ -177,77 +197,38 @@ import ElInputTagEx from '@/components/InputTagEx/index.vue'
checkPermission
}
})
export default class extends Vue {
@Prop({ default: false })
private showDialog!: boolean
@Prop({ default: '' })
private apiResourceId!: string
export default class ApiResourceScopeEditForm extends Vue {
@Prop({ default: () => { return new Array<Claim>() } })
private userClaims!: Claim[]
@Prop({ default: () => new Array<ApiScope>() })
private apiScopes!: ApiScope[]
@Prop({ default: () => { return new Array<ApiScope>() } })
private apiResourceScopes!: ApiScope[]
private apiScopeChanged: boolean
private apiScope: ApiScopeCreate
private apiScopeRules = {
private apiResourceScope = new ApiScope()
private apiResourceScopeRules = {
name: [
{ required: true, message: this.l('pleaseInputBy', { key: this.l('identityServer.apiScopeName') }), trigger: 'blur' }
{ required: true, message: this.l('pleaseInputBy', { key: this.l('AbpIdentityServer.Name') }), trigger: 'blur' }
]
}
constructor() {
super()
this.apiScopeChanged = false
this.apiScope = ApiScopeCreate.empty()
}
@Watch('apiResourceId', { immediate: true })
private onApiResourceIdChanged() {
this.apiScope.apiResourceId = this.apiResourceId
}
private handleDeleteApiScope(name: string) {
this.$confirm(this.l('identityServer.deleteApiScopeByName', { name: name }),
this.l('identityServer.deleteApiScope'), {
callback: (action) => {
if (action === 'confirm') {
ApiResourceService.deleteApiScope(this.apiResourceId, name).then(() => {
const deleteScopeIndex = this.apiScopes.findIndex(scope => scope.name === name)
this.apiScopes.splice(deleteScopeIndex, 1)
this.$message.success(this.l('identityServer.deleteApiScopeSuccess', { name: name }))
this.$emit('apiScopeChanged')
})
}
}
})
this.$emit('apiResourceScopeDeleted', name)
}
private onSaveApiScope() {
const frmApiScope = this.$refs.formApiScope as any
frmApiScope.validate((valid: boolean) => {
private onSave() {
const apiResourceScopeEditForm = this.$refs.apiResourceScopeEditForm as Form
apiResourceScopeEditForm.validate(valid => {
if (valid) {
this.apiScope.apiResourceId = this.apiResourceId
ApiResourceService.addApiScope(this.apiScope).then(scope => {
this.apiScopes.push(scope)
const successMessage = this.l('identityServer.createApiScopeSuccess', { name: this.apiScope.name })
this.$message.success(successMessage)
this.$emit('apiScopeChanged')
this.onFormClosed()
})
this.$emit('apiResourceScopeCreated',
this.apiResourceScope.name, this.apiResourceScope.required,
this.apiResourceScope.emphasize, this.apiResourceScope.showInDiscoveryDocument,
this.apiResourceScope.userClaims, this.apiResourceScope.displayName, this.apiResourceScope.description)
apiResourceScopeEditForm.resetFields()
this.apiResourceScope.userClaims.length = 0
}
})
}
private onFormClosed() {
this.resetFields()
this.$emit('closed')
}
public resetFields() {
const frmApiScope = this.$refs.formApiScope as any
frmApiScope.resetFields()
}
private l(name: string, values?: any[] | { [key: string]: any }) {
return this.$t(name, values).toString()
}
@ -258,4 +239,10 @@ export default class extends Vue {
.full-select {
width: 100%;
}
.transfer-scope-new ::v-deep .el-transfer-panel{
width: 236px;
}
.transfer-scope-edit ::v-deep .el-transfer-panel{
width: 216px;
}
</style>

172
vueJs/src/views/admin/identityServer/api-resources/components/ApiResourceSecretEditForm.vue

@ -1,29 +1,20 @@
<template>
<el-dialog
v-el-draggable-dialog
width="800px"
:visible="showDialog"
:title="$t('identityServer.apiResourceSecret')"
custom-class="modal-form"
:show-close="false"
@close="onFormClosed"
>
<div class="app-container">
<el-form
v-if="checkPermission(['IdentityServer.ApiResources.Secrets.Create'])"
ref="formApiSecret"
label-width="100px"
:model="apiSecret"
:rules="apiSecretRules"
ref="apiResourceSecretEditForm"
:model="apiResourceSecret"
label-width="80px"
:rules="apiResourceSecretRules"
>
<el-row>
<el-col :span="12">
<el-form-item
prop="type"
:label="$t('identityServer.secretType')"
:label="$t('AbpIdentityServer.Secret:Type')"
>
<el-select
v-model="apiSecret.type"
v-model="apiResourceSecret.type"
class="full-select"
:placeholder="$t('pleaseSelectBy', {key: $t('identityServer.secretType')})"
:placeholder="$t('pleaseSelectBy', {key: $t('AbpIdentityServer.Secret:Type')})"
>
<el-option
key="JWK"
@ -52,9 +43,11 @@
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
prop="hashType"
:label="$t('identityServer.secretHashType')"
:label="$t('AbpIdentityServer.Secret:HashType')"
>
<el-popover
ref="popHashType"
@ -63,11 +56,11 @@
:content="$t('identityServer.hashOnlySharedSecret')"
/>
<el-select
v-model="apiSecret.hashType"
v-model="apiResourceSecret.hashType"
v-popover:popHashType
:disabled="apiSecret.type !== 'SharedSecret'"
:disabled="apiResourceSecret.type !== 'SharedSecret'"
class="full-select"
:placeholder="$t('pleaseSelectBy', {key: $t('identityServer.secretHashType')})"
:placeholder="$t('pleaseSelectBy', {key: $t('AbpIdentityServer.Secret:HashType')})"
>
<el-option
:key="0"
@ -81,29 +74,31 @@
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item
prop="value"
:label="$t('identityServer.secretValue')"
:label="$t('AbpIdentityServer.Secret:Value')"
>
<el-input
v-model="apiSecret.value"
:placeholder="$t('pleaseInputBy', {key: $t('identityServer.secretValue')})"
v-model="apiResourceSecret.value"
:placeholder="$t('pleaseInputBy', {key: $t('AbpIdentityServer.Secret:Value')})"
/>
</el-form-item>
<el-form-item
prop="description"
:label="$t('identityServer.secretDescription')"
:label="$t('AbpIdentityServer.Description')"
>
<el-input
v-model="apiSecret.description"
v-model="apiResourceSecret.description"
/>
</el-form-item>
<el-form-item
prop="expiration"
:label="$t('identityServer.expiration')"
:label="$t('AbpIdentityServer.Expiration')"
>
<el-date-picker
v-model="apiSecret.expiration"
v-model="apiResourceSecret.expiration"
class="full-select"
type="datetime"
/>
@ -116,28 +111,24 @@
<el-button
type="primary"
style="width:180px"
@click="onSaveApiSecret"
@click="onSave"
>
{{ $t('identityServer.createApiSecret') }}
{{ $t('AbpIdentityServer.Secret:New') }}
</el-button>
</el-form-item>
<el-divider />
</el-form>
</div>
<el-table
row-key="value"
:data="apiSecrets"
:data="apiResourceSecrets"
border
fit
highlight-current-row
style="width: 100%;"
>
<el-table-column
:label="$t('identityServer.secretType')"
:label="$t('AbpIdentityServer.Secret:Type')"
prop="type"
sortable
width="150px"
width="170px"
align="center"
>
<template slot-scope="{row}">
@ -145,7 +136,7 @@
</template>
</el-table-column>
<el-table-column
:label="$t('identityServer.secretValue')"
:label="$t('AbpIdentityServer.Secret:Value')"
prop="value"
sortable
width="200px"
@ -156,9 +147,9 @@
</template>
</el-table-column>
<el-table-column
:label="$t('identityServer.secretDescription')"
:label="$t('AbpIdentityServer.Description')"
prop="description"
width="170px"
width="120px"
align="center"
>
<template slot-scope="{row}">
@ -166,7 +157,7 @@
</template>
</el-table-column>
<el-table-column
:label="$t('identityServer.expiration')"
:label="$t('AbpIdentityServer.Expiration')"
prop="expiration"
width="170px"
align="center"
@ -176,39 +167,38 @@
</template>
</el-table-column>
<el-table-column
:label="$t('operaActions')"
align="center"
width="150px"
width="80px"
fixed="right"
>
<template slot-scope="{row}">
<el-button
:disabled="!checkPermission(['IdentityServer.ApiResources.Secrets.Delete'])"
type="danger"
icon="el-icon-delete"
size="mini"
type="primary"
@click="handleDeleteApiSecret(row.type, row.value)"
>
{{ $t('identityServer.deleteApiSecret') }}
</el-button>
/>
</template>
</el-table-column>
</el-table>
</el-dialog>
</el-form>
</template>
<script lang="ts">
import ApiResourceService, { ApiSecret, ApiSecretCreate } from '@/api/apiresources'
import { Component, Vue, Prop, Watch } from 'vue-property-decorator'
import { ApiSecretCreateOrUpdate, ApiSecret } from '@/api/api-resources'
import { Component, Vue, Prop } from 'vue-property-decorator'
import { dateFormat } from '@/utils/index'
import { checkPermission } from '@/utils/permission'
import { Form } from 'element-ui'
@Component({
name: 'ApiSecretEditForm',
name: 'ApiResourceSecretEditForm',
filters: {
dateTimeFilter(datetime: string) {
if (datetime) {
const date = new Date(datetime)
return dateFormat(date, 'YYYY-mm-dd HH:MM')
return dateFormat(date, 'YYYY-mm-dd HH:MM:SS')
}
return ''
}
@ -217,78 +207,34 @@ import { checkPermission } from '@/utils/permission'
checkPermission
}
})
export default class extends Vue {
@Prop({ default: false })
private showDialog!: boolean
@Prop({ default: '' })
private apiResourceId!: string
export default class ApiResourceSecretEditForm extends Vue {
@Prop({ default: () => { return new Array<ApiSecret>() } })
private apiResourceSecrets!: ApiSecret[]
@Prop({ default: () => new Array<ApiSecret>() })
private apiSecrets!: ApiSecret[]
private apiSecretChanged: boolean
private apiSecret: ApiSecretCreate
private apiSecretRules = {
private apiResourceSecret = new ApiSecretCreateOrUpdate()
private apiResourceSecretRules = {
type: [
{ required: true, message: this.l('pleaseSelectBy', { key: this.l('identityServer.secretType') }), trigger: 'change' }
{ required: true, message: this.l('pleaseSelectBy', { key: this.l('AbpIdentityServer.Secret:Type') }), trigger: 'blur' }
],
value: [
{ required: true, message: this.l('pleaseInputBy', { key: this.l('identityServer.secretValue') }), trigger: 'blur' }
{ required: true, message: this.l('pleaseInputBy', { key: this.l('AbpIdentityServer.Secret:Value') }), trigger: 'blur' }
]
}
constructor() {
super()
this.apiSecretChanged = false
this.apiSecret = ApiSecretCreate.empty()
}
@Watch('apiResourceId', { immediate: true })
private onApiResourceIdChanged() {
this.apiSecret.apiResourceId = this.apiResourceId
}
private handleDeleteApiSecret(type: string, value: string) {
this.$confirm(this.l('identityServer.deleteApiSecretByType', { type: value }),
this.l('identityServer.deleteApiSecret'), {
callback: (action) => {
if (action === 'confirm') {
ApiResourceService.deleteApiSecret(this.apiResourceId, type, value).then(() => {
const deleteSecretIndex = this.apiSecrets.findIndex(secret => secret.type === type)
this.apiSecrets.splice(deleteSecretIndex, 1)
this.$message.success(this.l('identityServer.deleteApiSecretSuccess', { type: value }))
this.$emit('apiSecretChanged')
})
}
}
})
}
private onSaveApiSecret() {
const frmApiSecret = this.$refs.formApiSecret as any
frmApiSecret.validate((valid: boolean) => {
private onSave() {
const apiResourceSecretEditForm = this.$refs.apiResourceSecretEditForm as Form
apiResourceSecretEditForm.validate(valid => {
if (valid) {
this.apiSecret.apiResourceId = this.apiResourceId
ApiResourceService.addApiSecret(this.apiSecret).then(secret => {
this.apiSecrets.push(secret)
const successMessage = this.l('identityServer.createApiSecretSuccess', { type: this.apiSecret.type })
this.$message.success(successMessage)
this.$emit('apiSecretChanged')
this.onFormClosed()
})
this.$emit('apiResourceSecretCreated',
this.apiResourceSecret.hashType, this.apiResourceSecret.type, this.apiResourceSecret.value,
this.apiResourceSecret.description, this.apiResourceSecret.expiration)
apiResourceSecretEditForm.resetFields()
}
})
}
private onFormClosed() {
this.resetFields()
this.$emit('closed')
}
private resetFields() {
const frmApiSecret = this.$refs.formApiSecret as any
frmApiSecret.resetFields()
private handleDeleteApiSecret(type: string, value: string) {
this.$emit('apiResourceSecretDeleted', type, value)
}
private l(name: string, values?: any[] | { [key: string]: any }) {

135
vueJs/src/views/admin/identityServer/api-resources/index.vue

@ -23,9 +23,9 @@
class="filter-item"
type="primary"
:disabled="!checkPermission(['IdentityServer.ApiResources.Create'])"
@click="handleShowEditApiResourceForm()"
@click="handleShowEditApiResourceForm('')"
>
{{ $t('identityServer.createApiResource') }}
{{ $t('AbpIdentityServer.Resource:New') }}
</el-button>
</div>
@ -40,7 +40,7 @@
@sort-change="handleSortChange"
>
<el-table-column
:label="$t('identityServer.resourceName')"
:label="$t('AbpIdentityServer.Name')"
prop="name"
sortable
width="150px"
@ -51,7 +51,7 @@
</template>
</el-table-column>
<el-table-column
:label="$t('identityServer.resourceDisplayName')"
:label="$t('AbpIdentityServer.DisplayName')"
prop="displayName"
sortable
width="200px"
@ -62,20 +62,21 @@
</template>
</el-table-column>
<el-table-column
:label="$t('identityServer.resourceStatus')"
:label="$t('AbpIdentityServer.Required')"
prop="enabled"
sortable
width="140px"
align="center"
>
<template slot-scope="{row}">
<el-tag :type="row.enabled | statusFilter">
{{ formatStatusText(row.enabled) }}
</el-tag>
<el-switch
v-model="row.enabled"
disabled
/>
</template>
</el-table-column>
<el-table-column
:label="$t('identityServer.resourceDescription')"
:label="$t('AbpIdentityServer.Description')"
prop="description"
sortable
width="200px"
@ -123,43 +124,18 @@
:disabled="!checkPermission(['IdentityServer.ApiResources.Update'])"
size="mini"
type="primary"
@click="handleShowEditApiResourceForm(row)"
@click="handleShowEditApiResourceForm(row.id, row.name)"
>
{{ $t('identityServer.updateApiResource') }}
{{ $t('AbpIdentityServer.Resource:Edit') }}
</el-button>
<el-dropdown
class="options"
@command="handleCommand"
>
<el-button
v-permission="['IdentityServer.ApiResources']"
:disabled="!checkPermission(['IdentityServer.ApiResources.Delete'])"
size="mini"
type="info"
type="danger"
@click="handleDeleteApiResource(row.id, row.name)"
>
{{ $t('identityServer.otherOpera') }}<i class="el-icon-arrow-down el-icon--right" />
{{ $t('AbpIdentityServer.Resource:Delete') }}
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item
:command="{key: 'secret', row}"
:disabled="!checkPermission(['IdentityServer.ApiResources.Secrets'])"
>
{{ $t('identityServer.apiResourceSecret') }}
</el-dropdown-item>
<el-dropdown-item
:command="{key: 'scope', row}"
:disabled="!checkPermission(['IdentityServer.ApiResources.Scope'])"
>
{{ $t('identityServer.apiResourceScope') }}
</el-dropdown-item>
<el-dropdown-item
divided
:command="{key: 'delete', row}"
:disabled="!checkPermission(['IdentityServer.ApiResources.Delete'])"
>
{{ $t('identityServer.deleteApiResource') }}
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
@ -176,25 +152,9 @@
<api-resource-create-or-edit-form
:show-dialog="showEditApiResourceDialog"
:title="editApiResourceTitle"
:api-resource-id="editApiResource.id"
:api-resource-id="editApiResourceId"
@closed="handleApiResourceEditFormClosed"
/>
<api-secret-edit-form
:show-dialog="showEditApiSecretDialog"
:api-resource-id="editApiResource.id"
:api-secrets="editApiResource.secrets"
@apiSecretChanged="refreshPagedData"
@closed="handleApiSecretEditFormClosed"
/>
<api-scope-edit-form
:show-dialog="showEditApiScopeDialog"
:api-resource-id="editApiResource.id"
:api-scopes="editApiResource.scopes"
@apiSecretChanged="refreshPagedData"
@closed="handleApiScopeEditFormClosed"
/>
</div>
</template>
@ -204,17 +164,13 @@ import { checkPermission } from '@/utils/permission'
import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import Pagination from '@/components/Pagination/index.vue'
import ApiScopeEditForm from './components/ApiResourceScopeEditForm.vue'
import ApiSecretEditForm from './components/ApiResourceSecretEditForm.vue'
import ApiResourceCreateOrEditForm from './components/ApiResourceCreateOrEditForm.vue'
import ApiResourceService, { ApiResource, ApiResourceGetByPaged } from '@/api/apiresources'
import ApiResourceService, { ApiResourceGetByPaged } from '@/api/api-resources'
@Component({
name: 'IdentityServerApiResource',
components: {
Pagination,
ApiScopeEditForm,
ApiSecretEditForm,
ApiResourceCreateOrEditForm
},
methods: {
@ -237,7 +193,7 @@ import ApiResourceService, { ApiResource, ApiResourceGetByPaged } from '@/api/ap
}
})
export default class extends mixins(DataListMiXin) {
private editApiResource = new ApiResource()
private editApiResourceId =''
private editApiResourceTitle = ''
private showEditApiScopeDialog = false
@ -258,15 +214,13 @@ export default class extends mixins(DataListMiXin) {
return ApiResourceService.getApiResources(filter)
}
private handleShowEditApiResourceForm(resource: ApiResource) {
if (resource) {
this.editApiResource = resource
this.editApiResourceTitle = this.l('identityServer.updateApiResourceByName', { name: this.editApiResource.name })
} else {
this.editApiResource = ApiResource.empty()
this.editApiResourceTitle = this.l('identityServer.createApiResource')
}
private handleShowEditApiResourceForm(id: string, name: string) {
this.editApiResourceId = id
this.editApiResourceTitle = this.l('AbpIdentityServer.Resource:New')
this.showEditApiResourceDialog = true
if (name) {
this.editApiResourceTitle = this.l('AbpIdentityServer.Resource:Name', { 0: name })
}
}
private handleApiResourceEditFormClosed(changed: boolean) {
@ -281,49 +235,26 @@ export default class extends mixins(DataListMiXin) {
this.showEditApiSecretDialog = false
}
private handleApiScopeEditFormClosed() {
private handleApiScopeEditFormClosed(changed: boolean) {
this.showEditApiScopeDialog = false
if (changed) {
this.refreshPagedData()
}
}
private handleDeleteApiResource(id: string, name: string) {
this.$confirm(this.l('identityServer.deleteApiResourceByName', { name: name }),
this.l('identityServer.deleteApiResource'), {
private handleDeleteApiResource(id: string) {
this.$confirm(this.l('AbpIdentityServer.Resource:Delete'),
this.l('AbpUi.AreYouSure'), {
callback: (action) => {
if (action === 'confirm') {
ApiResourceService.deleteApiResource(id).then(() => {
this.$message.success(this.l('identityServer.deleteApiResourceSuccess', { name: name }))
this.$message.success(this.l('global.successful'))
this.refreshPagedData()
})
}
}
})
}
private handleCommand(command: {key: string, row: ApiResource}) {
this.editApiResource = command.row
switch (command.key) {
case 'secret' :
this.showEditApiSecretDialog = true
break
case 'scope' :
this.showEditApiScopeDialog = true
break
case 'delete' :
this.handleDeleteApiResource(command.row.id, command.row.name)
break
default: break
}
}
private formatStatusText(status: boolean) {
let statusText = ''
if (status) {
statusText = this.l('enabled')
} else {
statusText = this.l('disbled')
}
return statusText
}
}
</script>

41
vueJs/src/views/admin/identityServer/identity-resources/components/IdentityResourceCreateOrEditForm.vue

@ -79,10 +79,19 @@
prop="userClaims"
:label="$t('identityServer.resourceUserClaims')"
>
<el-input-tag-ex
<el-select
v-model="identityResource.userClaims"
label="type"
multiple
style="width: 100%;"
value-key="type"
>
<el-option
v-for="claim in identityClaims"
:key="claim.type"
:label="claim.type"
:value="claim"
/>
</el-select>
</el-form-item>
<el-form-item>
@ -108,15 +117,13 @@
</template>
<script lang="ts">
import IdentityResourceService, { IdentityResourceCreate, IdentityResourceUpdate, IdentityResource } from '@/api/identityresources'
import IdentityResourceService, { IdentityResourceCreate, IdentityResourceUpdate, IdentityResource, IdentityClaim } from '@/api/identityresources'
import ClaimTypeApiService from '@/api/cliam-type'
import { Component, Prop, Vue, Watch } from 'vue-property-decorator'
import ElInputTagEx from '@/components/InputTagEx/index.vue'
import { Form } from 'element-ui'
@Component({
name: 'IdentityResourceCreateOrEditForm',
components: {
ElInputTagEx
}
name: 'IdentityResourceCreateOrEditForm'
})
export default class extends Vue {
@Prop({ default: false })
@ -128,6 +135,7 @@ export default class extends Vue {
@Prop({ default: '' })
private identityResourceId!: string
private identityClaims = new Array<IdentityClaim>()
private identityResource: IdentityResource
private identityResourceRules = {
name: [
@ -158,6 +166,20 @@ export default class extends Vue {
}
}
mounted() {
this.handleGetClaimTypes()
}
private handleGetClaimTypes() {
ClaimTypeApiService.getActivedClaimTypes().then(res => {
res.items.map(claim => {
const identityClaim = new IdentityClaim()
identityClaim.type = claim.name
this.identityClaims.push(identityClaim)
})
})
}
private onSaveIdentityResource() {
const frmIdentityResource = this.$refs.formIdentityResource as any
frmIdentityResource.validate((valid: boolean) => {
@ -193,8 +215,7 @@ export default class extends Vue {
}
private resetFields() {
this.identityResource = IdentityResource.empty()
const frmIdentityResource = this.$refs.formIdentityResource as any
const frmIdentityResource = this.$refs.formIdentityResource as Form
frmIdentityResource.resetFields()
}

21
vueJs/src/views/admin/identityServer/identity-resources/index.vue

@ -166,19 +166,6 @@
@pagination="refreshPagedData"
@sort-change="handleSortChange"
/>
<identity-resource-create-or-edit-form
:show-dialog="showEditIdentityResourceDialog"
:title="editIdentityResourceTitle"
:identity-resource-id="editIdentityResource.id"
@closed="handleIdentityResourceEditFormClosed"
/>
<identity-property-edit-form
:show-dialog="showEditIdentityPropertyDialog"
:identity-resource="editIdentityResource"
@closed="handleIdentityPropertyEditFormClosed"
/>
</div>
</template>
@ -188,16 +175,12 @@ import { checkPermission } from '@/utils/permission'
import DataListMiXin from '@/mixins/DataListMiXin'
import Component, { mixins } from 'vue-class-component'
import Pagination from '@/components/Pagination/index.vue'
import IdentityPropertyEditForm from './components/IdentityResourcePropertyEditForm.vue'
import IdentityResourceCreateOrEditForm from './components/IdentityResourceCreateOrEditForm.vue'
import IdentityResourceService, { IdentityResource, IdentityResourceGetByPaged } from '@/api/identityresources'
import IdentityResourceService, { IdentityResource, IdentityResourceGetByPaged } from '@/api/identity-resources'
@Component({
name: 'IdentityServerIdentityResource',
components: {
Pagination,
IdentityPropertyEditForm,
IdentityResourceCreateOrEditForm
Pagination
},
methods: {
checkPermission

Loading…
Cancel
Save