public void Confirm(Guid correlationId) { correlationId = new AccountCorrelationId(correlationId); Confirmed = true; ChangeSecurityStamp(correlationId); var token = _tokens.SingleOrDefault(x => x.Type.Equals(TokenTypeEnumeration.AccountConfirmation)); _tokens.Remove(token); AddEvent(new AccountConfirmedDomainEvent(Id, correlationId)); }
public void RemoveRole(Guid role, Guid correlationId) { role = new AccountRole(role); correlationId = new AccountCorrelationId(correlationId); if (_roles.Contains(role)) { _roles.Remove(role); AddEvent(new AccountRoleDeletedDomainEvent(Id, correlationId, role)); } }
public void AddRole(Guid role, Guid correlationId) { role = new AccountRole(role); correlationId = new AccountCorrelationId(correlationId); var anyDuplicates = _roles.Any(x => x == role); if (!anyDuplicates) { _roles.Add(role); AddEvent(new AccountRoleAddedDomainEvent(Id, correlationId, role)); } }
public Token GenerateToken(TokenTypeEnumeration tokenType, Guid correlationId) { tokenType = new TokenType(tokenType); correlationId = new AccountCorrelationId(correlationId); var token = _tokens.SingleOrDefault(x => x.Type.Equals(tokenType)); _tokens.Remove(token); ChangeSecurityStamp(correlationId); token = _tokenGeneratorService.Generate(Id, SecurityStamp, tokenType); _tokens.Add(token); AddEvent(new AccountTokenGeneratedDomainEvent(Id, correlationId, token)); return(token); }
public void Login(Guid correlationId) { correlationId = new AccountCorrelationId(correlationId); LastLogin = DateTimeOffset.UtcNow; AddEvent(new AccountLoggedInDomainEvent(Id, correlationId, LastLogin.Value)); }
public void AddDeletedEvent(Guid correlationId) { correlationId = new AccountCorrelationId(correlationId); AddEvent(new AccountDeletedDomainEvent(Id, correlationId)); }
public void AddCreatedEvent(Guid correlationId) { correlationId = new AccountCorrelationId(correlationId); AddEvent(new AccountCreatedDomainEvent(Id, correlationId, Email, Confirmed, PasswordHash, SecurityStamp, Created, LastLogin)); }
private void ChangeSecurityStamp(Guid correlationId) { SecurityStamp = Guid.NewGuid(); correlationId = new AccountCorrelationId(correlationId); AddEvent(new AccountSecurityStampChangedDomainEvent(Id, correlationId, SecurityStamp)); }