some changes
This commit is contained in:
parent
4ec9720541
commit
b47bac67ca
37 changed files with 397 additions and 190 deletions
|
@ -0,0 +1,20 @@
|
|||
using Femto.Common.Infrastructure.Outbox;
|
||||
using Femto.Modules.Auth.Contracts.Events;
|
||||
using Femto.Modules.Auth.Data;
|
||||
using Femto.Modules.Auth.Models.Events;
|
||||
using MediatR;
|
||||
|
||||
namespace Femto.Modules.Auth.Models.DomainEventHandlers;
|
||||
|
||||
internal class UserWasCreatedHandler(Outbox<AuthContext> outbox)
|
||||
: INotificationHandler<UserWasCreatedEvent>
|
||||
{
|
||||
public async Task Handle(UserWasCreatedEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
await outbox.AddMessage(
|
||||
notification.User.Id,
|
||||
new UserWasCreatedIntegrationEvent(notification.User.Id, notification.User.Username),
|
||||
cancellationToken
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,12 +1,11 @@
|
|||
namespace Femto.Modules.Auth.Models;
|
||||
|
||||
public class UserSession
|
||||
internal class UserSession
|
||||
{
|
||||
private static TimeSpan SessionTimeout { get; } = TimeSpan.FromMinutes(30);
|
||||
private static TimeSpan ExpiryBuffer { get; } = TimeSpan.FromMinutes(5);
|
||||
public string Id { get; private set; }
|
||||
public DateTimeOffset Expires { get; private set; }
|
||||
|
||||
public bool ExpiresSoon => Expires < DateTimeOffset.UtcNow + ExpiryBuffer;
|
||||
|
||||
private UserSession() {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue