internal static PasswordIdentity Create( Identity identity, AuthenticationGrantTypePassword authenticationGrantTypePassword, CreatePasswordIdentityDdto createPasswordIdentityDdto) { return(new PasswordIdentity(identity, authenticationGrantTypePassword, createPasswordIdentityDdto)); }
public async Task <PasswordIdentity> ExecuteAsync(Identity identity, AuthenticationGrantTypePassword authenticationGrantTypePassword, RegisterPasswordCommandDdto registerPasswordCommandDdto) { _validator.ValidateAndThrow(registerPasswordCommandDdto); if (await _passwordIdentityIdentifierExistsQuery.RunAsync(registerPasswordCommandDdto.Identifier)) { throw new DomainValidationRuleException(new ValidationResult { PropertyValidationErrors = new List <PropertyValidationError> { PropertyValidationErrorFactory.Create(nameof(registerPasswordCommandDdto.Identifier), registerPasswordCommandDdto.Identifier, ValidationErrorCodes.NotUnique) } }); } if (await _passwordIdentityEmailExistsQuery.RunAsync(registerPasswordCommandDdto.EmailAddress)) { throw new DomainValidationRuleException(new ValidationResult { PropertyValidationErrors = new List <PropertyValidationError> { PropertyValidationErrorFactory.Create(nameof(registerPasswordCommandDdto.EmailAddress), registerPasswordCommandDdto.EmailAddress, ValidationErrorCodes.NotUnique) } }); } return(await identity.RegisterPassword(authenticationGrantTypePassword, new RegisterPasswordDdto { Identifier = registerPasswordCommandDdto.Identifier, Password = registerPasswordCommandDdto.Password, EmailAddress = registerPasswordCommandDdto.EmailAddress })); }
private PasswordIdentity( Identity identity, AuthenticationGrantTypePassword authenticationGrantTypePassword, CreatePasswordIdentityDdto createPasswordIdentityDdto) { Identity = identity; AuthenticationGrantTypePassword = authenticationGrantTypePassword; Identifier = createPasswordIdentityDdto.Identifier; Password = createPasswordIdentityDdto.Password; EmailAddress = createPasswordIdentityDdto.EmailAddress; }