Browse Source

feat(profile): use a separate service to manage user claims

pull/438/head
cKey 4 years ago
parent
commit
2f59275f6e
  1. 13
      apps/vue/src/api/account/claims.ts
  2. 3
      apps/vue/src/api/account/model/claimsModel.ts
  3. 5
      apps/vue/src/api/account/model/profilesModel.ts
  4. 9
      apps/vue/src/api/account/profiles.ts
  5. 5
      apps/vue/src/api/oss-management/private.ts
  6. 2
      apps/vue/src/layouts/default/header/components/notify/useMessages.ts
  7. 2
      apps/vue/src/layouts/default/header/components/notify/useNotifications.ts
  8. 14
      apps/vue/src/views/account/setting/BaseSetting.vue
  9. 11
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/ChangeAvatarInput.cs
  10. 10
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/IMyClaimAppService.cs
  11. 6
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/IMyProfileAppService.cs
  12. 17
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs
  13. 29
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountApplicationServiceBase.cs
  14. 29
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyClaimAppService.cs
  15. 49
      aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs
  16. 30
      aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN/Abp/Account/MyClaimController.cs
  17. 11
      aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN/Abp/Account/MyProfileController.cs
  18. 15
      aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/IdentityConsts.cs
  19. 9
      aspnet-core/services/LY.MicroService.identityServer/IdentityResources/CustomIdentityResources.cs
  20. 1
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayModule.cs
  21. 121
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/ocelot.Development.json
  22. 86
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/ocelot.messages.json
  23. 51
      gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/ocelot.platform.json

13
apps/vue/src/api/account/claims.ts

@ -0,0 +1,13 @@
import { defAbpHttp } from '/@/utils/http/abp';
import { ChangeAvatar } from './model/claimsModel';
enum Api {
ChangeAvatar = '/api/account/my-claim/change-avatar',
}
export const changeAvatar = (input: ChangeAvatar) => {
return defAbpHttp.post<void>({
url: Api.ChangeAvatar,
data: input.avatarUrl,
});
};

3
apps/vue/src/api/account/model/claimsModel.ts

@ -0,0 +1,3 @@
export interface ChangeAvatar {
avatarUrl: string;
}

5
apps/vue/src/api/account/model/profilesModel.ts

@ -28,8 +28,3 @@ export interface ChangePhoneNumber {
export interface TwoFactorEnabled {
enabled: boolean;
}
export interface IdentityUserClaimSet {
claimType: string;
claimValue: string;
}

9
apps/vue/src/api/account/profiles.ts

@ -5,7 +5,6 @@ import {
ChangePassword,
ChangePhoneNumber,
TwoFactorEnabled,
IdentityUserClaimSet,
} from './model/profilesModel';
enum Api {
@ -16,7 +15,6 @@ enum Api {
ChangePhoneNumber = '/api/identity/my-profile/change-phone-number',
GetTwoFactorEnabled = '/api/identity/my-profile/two-factor',
ChangeTwoFactorEnabled = '/api/identity/my-profile/change-two-factor',
SetClaim = '/api/identity/my-profile/claims',
}
export const get = () => {
@ -39,13 +37,6 @@ export const changePassword = (input: ChangePassword) => {
});
};
export const setClaim = (input: IdentityUserClaimSet) => {
return defAbpHttp.put<void>({
url: Api.SetClaim,
data: input,
});
};
export const sendChangePhoneNumberCode = (phoneNumber: string) => {
return defAbpHttp.put<void>({
url: Api.SendChangePhoneNumberCode,

5
apps/vue/src/api/oss-management/private.ts

@ -5,7 +5,7 @@ import { AxiosResponse } from 'axios';
import { ListResultDto } from '../model/baseModel';
enum Api {
Upload = '/api/api/files/private/{path}/{name}',
Upload = '/api/api/files/private',
Get = '/api/api/files/private/p/{path}/{name}',
GetList = '/api/files/private/search',
Share = '/api/files/private/share',
@ -21,9 +21,10 @@ export const upload = (file: Blob, path: string, name: string) => {
defHttp
.uploadFile<OssObject>(
{
url: format(Api.Upload, { path: path, name: name }),
url: Api.Upload,
},
{
data: { path: path, object: name },
file: file,
},
)

2
apps/vue/src/layouts/default/header/components/notify/useMessages.ts

@ -29,7 +29,7 @@ export function useMessages() {
const { createConfirm, createMessage } = useMessage();
const signalR = useSignalR({
autoStart: false,
serverUrl: '/signalr-hubs/messages',
serverUrl: '/signalr-hubs/signalr-hubs/messages',
});
onMounted(() => {

2
apps/vue/src/layouts/default/header/components/notify/useNotifications.ts

@ -26,7 +26,7 @@ export function useNotifications() {
list: [],
});
const signalR = useSignalR({
serverUrl: '/signalr-hubs/notifications',
serverUrl: '/signalr-hubs/signalr-hubs/notifications',
});
onMounted(() => {

14
apps/vue/src/views/account/setting/BaseSetting.vue

@ -37,7 +37,8 @@
import headerImg from '/@/assets/icons/64x64/color-user.png';
import { useUserStore } from '/@/store/modules/user';
import { upload } from '/@/api/oss-management/private';
import { get as getProfile, update as updateProfile, setClaim } from '/@/api/account/profiles';
import { changeAvatar } from '/@/api/account/claims';
import { get as getProfile, update as updateProfile } from '/@/api/account/profiles';
import { UpdateMyProfile } from '/@/api/account/model/profilesModel';
import { useLocalization } from '/@/hooks/abp/useLocalization';
import { useProfile } from './useProfile';
@ -83,14 +84,9 @@
upload(params.file, 'avatar', params.filename)
.then((res) => {
const path = encodeURIComponent(res.data.path.substring(0, res.data.path.length - 1));
setClaim({
claimType: 'avatarUrl',
claimValue: `${path}/${res.data.name}`,
})
.then(() => {
resolve(res as unknown as void);
})
.catch((err) => reject(err));
changeAvatar({ avatarUrl: `${path}/${res.data.name}` }).then(() => {
resolve(res as unknown as void);
}).catch((err) => reject(err));
})
.catch((err) => reject(err));
});

11
aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/ChangeAvatarInput.cs

@ -0,0 +1,11 @@
using Volo.Abp.Identity;
using Volo.Abp.Validation;
namespace LINGYUN.Abp.Account
{
public class ChangeAvatarInput
{
[DynamicMaxLength(typeof(IdentityUserClaimConsts), nameof(IdentityUserClaimConsts.MaxClaimValueLength))]
public string AvatarUrl { get; set; }
}
}

10
aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/IMyClaimAppService.cs

@ -0,0 +1,10 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace LINGYUN.Abp.Account
{
public interface IMyClaimAppService : IApplicationService
{
Task ChangeAvatarAsync(ChangeAvatarInput input);
}
}

6
aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/IMyProfileAppService.cs

@ -5,12 +5,6 @@ namespace LINGYUN.Abp.Account
{
public interface IMyProfileAppService : IApplicationService
{
/// <summary>
/// 设置声明
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task SetClaimAsync(ChangeUserClaimInput input);
/// <summary>
/// 获取二次认证状态
/// </summary>

17
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountAppService.cs

@ -12,8 +12,6 @@ using System.ComponentModel.DataAnnotations;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Account.Localization;
using Volo.Abp.Application.Services;
using Volo.Abp.Caching;
using Volo.Abp.Identity;
using Volo.Abp.Settings;
@ -22,40 +20,29 @@ using IIdentityUserRepository = LINGYUN.Abp.Identity.IIdentityUserRepository;
namespace LINGYUN.Abp.Account
{
public class AccountAppService : ApplicationService, IAccountAppService
public class AccountAppService : AccountApplicationServiceBase, IAccountAppService
{
protected ITotpService TotpService { get; }
protected IdentityUserStore UserStore { get; }
protected IdentityUserManager UserManager { get; }
protected IIdentityUserRepository UserRepository { get; }
protected IUserSecurityCodeSender SecurityCodeSender { get; }
protected IWeChatOpenIdFinder WeChatOpenIdFinder { get; }
protected IOptions<IdentityOptions> IdentityOptions { get; }
protected AbpWeChatMiniProgramOptionsFactory MiniProgramOptionsFactory { get; }
protected IDistributedCache<SmsSecurityTokenCacheItem> SecurityTokenCache { get; }
public AccountAppService(
ITotpService totpService,
IdentityUserStore userStore,
IdentityUserManager userManager,
IWeChatOpenIdFinder weChatOpenIdFinder,
IIdentityUserRepository userRepository,
IUserSecurityCodeSender securityCodeSender,
IDistributedCache<SmsSecurityTokenCacheItem> securityTokenCache,
AbpWeChatMiniProgramOptionsFactory miniProgramOptionsFactory,
IOptions<IdentityOptions> identityOptions)
AbpWeChatMiniProgramOptionsFactory miniProgramOptionsFactory)
{
TotpService = totpService;
UserStore = userStore;
UserManager = userManager;
UserRepository = userRepository;
WeChatOpenIdFinder = weChatOpenIdFinder;
SecurityCodeSender = securityCodeSender;
SecurityTokenCache = securityTokenCache;
MiniProgramOptionsFactory = miniProgramOptionsFactory;
IdentityOptions = identityOptions;
LocalizationResource = typeof(AccountResource);
}
public virtual async Task RegisterAsync(WeChatRegisterDto input)

29
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/AccountApplicationServiceBase.cs

@ -0,0 +1,29 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Options;
using System.Threading.Tasks;
using Volo.Abp.Account.Localization;
using Volo.Abp.Application.Services;
using Volo.Abp.Identity;
using Volo.Abp.Users;
namespace LINGYUN.Abp.Account
{
public abstract class AccountApplicationServiceBase : ApplicationService
{
protected IOptions<IdentityOptions> IdentityOptions => LazyServiceProvider.LazyGetRequiredService<IOptions<IdentityOptions>>();
protected IdentityUserStore UserStore => LazyServiceProvider.LazyGetRequiredService<IdentityUserStore>();
protected IdentityUserManager UserManager => LazyServiceProvider.LazyGetRequiredService<IdentityUserManager>();
protected AccountApplicationServiceBase()
{
LocalizationResource = typeof(AccountResource);
}
protected virtual async Task<IdentityUser> GetCurrentUserAsync()
{
await IdentityOptions.SetAsync();
return await UserManager.GetByIdAsync(CurrentUser.GetId());
}
}
}

29
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyClaimAppService.cs

@ -0,0 +1,29 @@
using LINGYUN.Abp.Identity;
using Microsoft.AspNetCore.Identity;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
namespace LINGYUN.Abp.Account
{
public class MyClaimAppService : AccountApplicationServiceBase, IMyClaimAppService
{
public MyClaimAppService()
{
}
public virtual async Task ChangeAvatarAsync(ChangeAvatarInput input)
{
var user = await GetCurrentUserAsync();
user.Claims.RemoveAll(x => x.ClaimType.Equals(IdentityConsts.ClaimType.Avatar.Name));
user.AddClaim(GuidGenerator, new Claim(IdentityConsts.ClaimType.Avatar.Name, input.AvatarUrl));
(await UserManager.UpdateAsync(user)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
}
}
}

49
aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs

@ -2,72 +2,37 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Options;
using System;
using System.Security.Claims;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Account.Localization;
using Volo.Abp.Application.Services;
using Volo.Abp.Caching;
using Volo.Abp.Identity;
using Volo.Abp.Settings;
using Volo.Abp.Users;
namespace LINGYUN.Abp.Account
{
[Authorize]
public class MyProfileAppService : ApplicationService, IMyProfileAppService
public class MyProfileAppService : AccountApplicationServiceBase, IMyProfileAppService
{
protected IDistributedCache<SmsSecurityTokenCacheItem> SecurityTokenCache { get; }
protected IUserSecurityCodeSender SecurityCodeSender { get; }
protected IdentityUserManager UserManager { get; }
protected Identity.IIdentityUserRepository UserRepository { get; }
protected IOptions<IdentityOptions> IdentityOptions { get; }
public MyProfileAppService(
IdentityUserManager userManager,
Identity.IIdentityUserRepository userRepository,
IUserSecurityCodeSender securityCodeSender,
IOptions<IdentityOptions> identityOptions,
IDistributedCache<SmsSecurityTokenCacheItem> securityTokenCache)
{
UserManager = userManager;
UserRepository = userRepository;
IdentityOptions = identityOptions;
SecurityCodeSender = securityCodeSender;
SecurityTokenCache = securityTokenCache;
LocalizationResource = typeof(AccountResource);
}
public virtual async Task SetClaimAsync(ChangeUserClaimInput input)
{
await IdentityOptions.SetAsync();
var user = await UserManager.GetByIdAsync(CurrentUser.GetId());
var newClaim = new Claim(input.ClaimType, input.ClaimValue);
var currentClaim = user.FindClaim(newClaim);
if (currentClaim != null)
{
// Replace With Claim Value Empty?
// (await UserManager.ReplaceClaimAsync(user, currentClaim.ToClaim(), newClaim)).CheckErrors();
user.ReplaceClaim(currentClaim.ToClaim(), newClaim);
}
else
{
// (await UserManager.AddClaimAsync(user, newClaim)).CheckErrors();
user.AddClaim(GuidGenerator, newClaim);
}
(await UserManager.UpdateAsync(user)).CheckErrors();
await CurrentUnitOfWork.SaveChangesAsync();
}
public virtual async Task<TwoFactorEnabledDto> GetTwoFactorEnabledAsync()
{
await IdentityOptions.SetAsync();
var user = await UserManager.GetByIdAsync(CurrentUser.GetId());
var user = await GetCurrentUserAsync();
return new TwoFactorEnabledDto
{
@ -83,8 +48,7 @@ namespace LINGYUN.Abp.Account
// throw new BusinessException(Volo.Abp.Identity.IdentityErrorCodes.CanNotChangeTwoFactor);
//}
// TODO: Abp官方移除了双因素的设置,不排除以后会增加,如果在用户接口中启用了双因素认证,可能造成登录失败!
await IdentityOptions.SetAsync();
var user = await UserManager.GetByIdAsync(CurrentUser.GetId());
var user = await GetCurrentUserAsync();
(await UserManager.SetTwoFactorEnabledWithAccountConfirmedAsync(user, input.Enabled)).CheckErrors();
@ -106,7 +70,8 @@ namespace LINGYUN.Abp.Account
{
throw new BusinessException(Identity.IdentityErrorCodes.DuplicatePhoneNumber);
}
var user = await UserManager.GetByIdAsync(CurrentUser.GetId());
var user = await GetCurrentUserAsync();
var template = await SettingProvider.GetOrNullAsync(Identity.Settings.IdentitySettingNames.User.SmsPhoneNumberConfirmed);
var token = await UserManager.GenerateChangePhoneNumberTokenAsync(user, input.NewPhoneNumber);
// 发送验证码
@ -128,9 +93,7 @@ namespace LINGYUN.Abp.Account
{
throw new BusinessException(Identity.IdentityErrorCodes.DuplicatePhoneNumber);
}
await IdentityOptions.SetAsync();
//TODO: 可以查询缓存用 securityTokenCacheItem.SecurityToken 与 user.SecurityStamp 作对比
var user = await UserManager.GetByIdAsync(CurrentUser.GetId());
var user = await GetCurrentUserAsync();
// 更换手机号
(await UserManager.ChangePhoneNumberAsync(user, input.NewPhoneNumber, input.Code)).CheckErrors();

30
aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN/Abp/Account/MyClaimController.cs

@ -0,0 +1,30 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.AspNetCore.Mvc;
namespace LINGYUN.Abp.Account
{
[RemoteService(Name = AccountRemoteServiceConsts.RemoteServiceName)]
[Area("account")]
[ControllerName("Profile")]
[Route("/api/account/my-claim")]
public class MyClaimController : AbpController, IMyClaimAppService
{
private readonly IMyClaimAppService _service;
public MyClaimController(
IMyClaimAppService service)
{
_service = service;
}
[HttpPost]
[Route("change-avatar")]
public virtual async Task ChangeAvatarAsync(ChangeAvatarInput input)
{
await _service.ChangeAvatarAsync(input);
}
}
}

11
aspnet-core/modules/account/LINGYUN.Abp.Account.HttpApi/LINGYUN/Abp/Account/MyProfileController.cs

@ -1,12 +1,12 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Identity;
namespace LINGYUN.Abp.Account
{
[RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)]
[RemoteService(Name = AccountRemoteServiceConsts.RemoteServiceName)]
[Area("account")]
[ControllerName("Profile")]
[Route("/api/account/my-profile")]
@ -20,13 +20,6 @@ namespace LINGYUN.Abp.Account
MyProfileAppService = myProfileAppService;
}
[HttpPut]
[Route("claims")]
public virtual async Task SetClaimAsync(ChangeUserClaimInput input)
{
await MyProfileAppService.SetClaimAsync(input);
}
[HttpGet]
[Route("two-factor")]
public virtual async Task<TwoFactorEnabledDto> GetTwoFactorEnabledAsync()

15
aspnet-core/modules/identity/LINGYUN.Abp.Identity.Domain.Shared/LINGYUN/Abp/Identity/IdentityConsts.cs

@ -0,0 +1,15 @@
namespace LINGYUN.Abp.Identity
{
public static class IdentityConsts
{
public static class ClaimType
{
public static class Avatar
{
public static string Name { get; set; } = "avatarUrl";
public static string DisplayName { get; set; } = "Your avatar url";
public static string Description { get; set; } = "Your avatar url";
}
}
}
}

9
aspnet-core/services/LY.MicroService.identityServer/IdentityResources/CustomIdentityResources.cs

@ -1,4 +1,5 @@
using IdentityServer4.Models;
using LINGYUN.Abp.Identity;
namespace LY.MicroService.IdentityServer.IdentityResources;
@ -6,13 +7,13 @@ public class CustomIdentityResources
{
public class AvatarUrl : IdentityResource
{
public static string ClaimType { get; set; } = "avatarUrl";
public AvatarUrl()
{
Name = ClaimType;
DisplayName = "Your avatar url";
Name = IdentityConsts.ClaimType.Avatar.Name;
DisplayName = IdentityConsts.ClaimType.Avatar.DisplayName;
Description = IdentityConsts.ClaimType.Avatar.Description;
Emphasize = true;
UserClaims = new string[] { ClaimType };
UserClaims = new string[] { IdentityConsts.ClaimType.Avatar.Name };
}
}
}

1
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayModule.cs

@ -53,7 +53,6 @@ namespace LINGYUN.MicroService.Internal.ApiGateway
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
var sss = app.ApplicationServices.GetRequiredService<IOptions<FileConfiguration>>();
app.UseForwardedHeaders();
app.UseAuditing();
app.UseStaticFiles();

121
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/ocelot.Development.json

@ -940,6 +940,42 @@
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/my-subscribes",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/api/my-subscribes",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 5
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Priority": 99
},
{
"DownstreamPathTemplate": "/api/my-subscribes/{everything}",
"DownstreamScheme": "http",
@ -1299,6 +1335,41 @@
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/files/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/api/api/files/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 5
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/setting-management/oss-management/by-current-tenant",
"DownstreamScheme": "http",
@ -1397,6 +1468,56 @@
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/signalr-hubs/messages",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/signalr-hubs/messages",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "OPTIONS" ],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {},
"DangerousAcceptAnyServerCertificateValidator": true,
"RouteIsCaseSensitive": false,
"Priority": 99
},
{
"DownstreamPathTemplate": "/signalr-hubs/notifications",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/signalr-hubs/notifications",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "OPTIONS" ],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {},
"DangerousAcceptAnyServerCertificateValidator": true,
"RouteIsCaseSensitive": false,
"Priority": 99
},
{
"DownstreamPathTemplate": "/signalr-hubs/{everything}",
"DownstreamScheme": "ws",

86
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/ocelot.messages.json

@ -114,6 +114,42 @@
"UseTracing": true
}
},
{
"DownstreamPathTemplate": "/api/my-subscribes",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/api/my-subscribes",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 5
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
},
"Priority": 99
},
// û
{
"DownstreamPathTemplate": "/api/my-subscribes/{everything}",
@ -309,6 +345,56 @@
}
},
//
{
"DownstreamPathTemplate": "/signalr-hubs/messages",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/signalr-hubs/messages",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "OPTIONS" ],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {},
"DangerousAcceptAnyServerCertificateValidator": true,
"RouteIsCaseSensitive": false,
"Priority": 99
},
{
"DownstreamPathTemplate": "/signalr-hubs/notifications",
"DownstreamScheme": "ws",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30020
}
],
"UpstreamPathTemplate": "/signalr-hubs/notifications",
"UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "OPTIONS" ],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {},
"DangerousAcceptAnyServerCertificateValidator": true,
"RouteIsCaseSensitive": false,
"Priority": 99
},
{
"DownstreamPathTemplate": "/signalr-hubs/{everything}",
"DownstreamScheme": "ws",

51
gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/ocelot.platform.json

@ -1,6 +1,6 @@
{
"Routes": [
//
// ܶ˵
{
"DownstreamPathTemplate": "/api/abp/application-configuration",
"DownstreamScheme": "http",
@ -26,7 +26,7 @@
},
"Key": "platform-configuration"
},
// API
// ̬ܶAPI˵
{
"DownstreamPathTemplate": "/api/abp/api-definition",
"DownstreamScheme": "http",
@ -52,7 +52,7 @@
},
"Key": "platform-api-definition"
},
//
//
{
"DownstreamPathTemplate": "/api/oss-management/{everything}",
"DownstreamScheme": "http",
@ -83,7 +83,7 @@
"UseTracing": true
}
},
//
// ƽ̨
{
"DownstreamPathTemplate": "/api/platform/{everything}",
"DownstreamScheme": "http",
@ -114,7 +114,7 @@
"UseTracing": true
}
},
// 访
// ļ
{
"DownstreamPathTemplate": "/api/files/{everything}",
"DownstreamScheme": "http",
@ -145,7 +145,42 @@
"UseTracing": true
}
},
//
{
"DownstreamPathTemplate": "/api/files/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "127.0.0.1",
"Port": 30025
}
],
"UpstreamPathTemplate": "/api/api/files/{everything}",
"UpstreamHttpMethod": [
"GET",
"POST",
"PUT",
"DELETE"
],
"LoadBalancerOptions": {
"Type": "RoundRobin"
},
"RateLimitOptions": {
"ClientWhitelist": [],
"EnableRateLimiting": true,
"Period": "1s",
"PeriodTimespan": 1,
"Limit": 5
},
"QoSOptions": {
"ExceptionsAllowedBeforeBreaking": 10,
"DurationOfBreak": 1000,
"TimeoutValue": 10000
},
"HttpHandlerOptions": {
"UseTracing": true
}
},
//
{
"DownstreamPathTemplate": "/api/setting-management/oss-management/by-current-tenant",
"DownstreamScheme": "http",
@ -177,7 +212,7 @@
},
"Key": "oss-management-setting-current-tenant"
},
//
// ȫ
{
"DownstreamPathTemplate": "/api/setting-management/oss-management/by-global",
"DownstreamScheme": "http",
@ -209,7 +244,7 @@
},
"Key": "oss-management-setting-global"
},
// API
// API ĵ
{
"DownstreamPathTemplate": "/swagger/v1/swagger.json",
"DownstreamScheme": "http",

Loading…
Cancel
Save