Пример #1
0
        public void When(IDomainIdentityService ids, PasswordGenerator pwds, CreateSecurityFromRegistration c)
        {
            Apply(new SecurityAggregateCreated(c.Id));

            var user  = new UserId(ids.GetId());
            var salt  = pwds.CreateSalt();
            var token = pwds.CreateToken();
            var hash  = pwds.HashPassword(c.Pwd, salt);

            Apply(new SecurityPasswordAdded(c.Id, user, c.DisplayName, c.Login, hash, salt, token));
            if (!string.IsNullOrEmpty(c.OptionalIdentity))
            {
                AddIdentity(ids, pwds, c.DisplayName, c.OptionalIdentity);
            }
            Apply(new SecurityRegistrationProcessCompleted(c.Id, c.DisplayName, user, token, c.RegistrationId));
        }
Пример #2
0
        public void When(IDomainIdentityService ids, PasswordGenerator pwds, CreateSecurityFromRegistration c)
        {
            Apply(new SecurityAggregateCreated(c.Id));

            var user = new UserId(ids.GetId());
            var salt = pwds.CreateSalt();
            var token = pwds.CreateToken();
            var hash = pwds.HashPassword(c.Pwd, salt);

            Apply(new SecurityPasswordAdded(c.Id, user, c.DisplayName, c.Login, hash, salt, token));
            if (!string.IsNullOrEmpty(c.OptionalIdentity))
            {
                AddIdentity(ids, pwds, c.DisplayName, c.OptionalIdentity);
            }
            Apply(new SecurityRegistrationProcessCompleted(c.Id, c.DisplayName, user, token, c.RegistrationId));
        }
Пример #3
0
        public void When(CreateSecurityFromRegistration c)
        {
            Apply(new SecurityAggregateCreated(c.Id));
            var user  = new UserId(_identityGenerator.GetId());
            var salt  = _generator.CreateSalt();
            var token = _generator.CreateToken();
            var hash  = _generator.HashPassword(c.Pwd, salt);

            Apply(new SecurityPasswordAdded(c.Id, user, c.DisplayName, c.Login, hash, salt, token));
            if (!string.IsNullOrEmpty(c.OptionalIdentity))
            {
                var u2 = new UserId(_identityGenerator.GetId());

                Apply(new SecurityIdentityAdded(c.Id, u2, c.DisplayName, c.OptionalIdentity, _generator.CreateToken()));
            }
            Apply(new SecurityRegistrationProcessCompleted(c.Id, c.DisplayName, user, token, c.RegistrationId));
        }
 public void When(CreateSecurityFromRegistration c)
 {
     Update(c, ar => ar.When(_ids, _pwds, c));
 }
 public void When(CreateSecurityFromRegistration c)
 {
     Update(c, ar => ar.When(_ids, _pwds, c));
 }