public async Task <PasswordAdto> RegisterPasswordAsync(RegisterPasswordAdto registerPasswordAdto) { using (ITransaction transaction = _transactionManager.Create()) { try { Identity identity = await _createIdentityCommand.ExecuteAsync(); await _registerPasswordCommand.ExecuteAsync(identity, await GetAuthenticationGrantTypePasswordAsync(), new RegisterPasswordCommandDdto { Identifier = registerPasswordAdto.Identifier, Password = registerPasswordAdto.Password, ConfirmPassword = registerPasswordAdto.ConfirmPassword, EmailAddress = registerPasswordAdto.EmailAddress }); await _identityCommandRepository.AddAsync(identity); transaction.Commit(); return(new PasswordAdto { IdentityId = identity.Id }); } catch (DomainValidationRuleException e) { throw new BusinessValidationRuleApplicationException(e.ValidationResult); } } }
public Task <PasswordAdto> RegisterPasswordAsync(RegisterPasswordAdto registerPasswordAdto) { return(_securityApplicationService.SecureAsync(() => _identityApplicationService.RegisterPasswordAsync(registerPasswordAdto), DefaultAuthorisationContext.Create(AuthorisationResource.Identity, AuthorisationAction.Create))); }