Skip to content

Commit

Permalink
Merge pull request #992 from colinin/new-user-session
Browse files Browse the repository at this point in the history
feat(session): 新用户默认订阅会话过期事件
  • Loading branch information
colinin authored Aug 16, 2024
2 parents e26a613 + 5501f7e commit 6f1c86e
Showing 1 changed file with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
}

0 comments on commit 6f1c86e

Please sign in to comment.