Browse Source

Merge pull request #992 from colinin/new-user-session

feat(session): 新用户默认订阅会话过期事件
pull/1010/head
yx lin 1 year ago
committed by GitHub
parent
commit
6f1c86eda7
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 28
      aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/EventBus/Local/UserSubscribeSessionExpirationEventHandler.cs

28
aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/EventBus/Local/UserSubscribeSessionExpirationEventHandler.cs

@ -0,0 +1,28 @@
using LINGYUN.Abp.Identity.Notifications;
using LINGYUN.Abp.Notifications;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.EventBus;
using Volo.Abp.Users;
namespace LY.MicroService.RealtimeMessage.EventBus;
public class UserSubscribeSessionExpirationEventHandler : ILocalEventHandler<EntityCreatedEventData<UserEto>>, ITransientDependency
{
private readonly INotificationSubscriptionManager _notificationSubscriptionManager;
public UserSubscribeSessionExpirationEventHandler(INotificationSubscriptionManager notificationSubscriptionManager)
{
_notificationSubscriptionManager = notificationSubscriptionManager;
}
public async virtual Task HandleEventAsync(EntityCreatedEventData<UserEto> eventData)
{
await _notificationSubscriptionManager
.SubscribeAsync(
eventData.Entity.TenantId,
new UserIdentifier(eventData.Entity.Id, eventData.Entity.UserName),
IdentityNotificationNames.Session.ExpirationSession);
}
}
Loading…
Cancel
Save