コード例 #1
0
ファイル: PasswordUtils.cs プロジェクト: kubo08/Orchard
 public static string EncodePassword(string value, IEncryptionService encryptionService)
 {
     return
         string.IsNullOrWhiteSpace(value) ?
         string.Empty :
         Convert.ToBase64String(encryptionService.Encode(Encoding.UTF8.GetBytes(value)));
 }
コード例 #2
0
 public DoubanOAuthService(IEncryptionService oauthHelper, IQuickLogOnService quickLogOnService)
 {
     _quickLogOnService = quickLogOnService;
     _oauthHelper = oauthHelper;
     T = NullLocalizer.Instance;
     Logger = NullLogger.Instance;
 }
コード例 #3
0
 public IdentityService(ILearnWithQBUow uow, IEncryptionService encryptionService, ISessionService sessionService, ICacheProvider cacheProvider)
     : base(cacheProvider)
 {
     this.uow = uow;
     this.sessionService = sessionService;
     this.encryptionService = encryptionService;
 }
コード例 #4
0
ファイル: AuthenticationService.cs プロジェクト: UStack/UWeb
 public AuthenticationService(IRequest request, IOutputWriter outputWriter, BasicAuthenticationCookieConfiguration basicAuthenticationCookieConfiguration, IEncryptionService encryptionService)
 {
     this.request = request;
     this.outputWriter = outputWriter;
     this.basicAuthenticationCookieConfiguration = basicAuthenticationCookieConfiguration;
     this.encryptionService = encryptionService;
 }
コード例 #5
0
 public IdentityService(IVideoOnDemandUow uow, IEncryptionService encryptionService, ISessionService sessionService, ICacheProvider cacheProvider)
     : base(cacheProvider)
 {
     this.uow = uow;
     this.sessionService = sessionService;
     this.encryptionService = encryptionService;
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="customerService">Customer service</param>
 /// <param name="encryptionService">Encryption service</param>
 public CustomerRegistrationService(ICustomerService customerService,
     IEncryptionService encryptionService
     )
 {
     this._customerService = customerService;
     this._encryptionService = encryptionService;
 }
コード例 #7
0
 public IdentityService(IWeddingBiddersUow uow, IEncryptionService encryptionService, ISessionService sessionService, ICacheProvider cacheProvider)
     : base(cacheProvider)
 {
     this.uow = uow;
     this.sessionService = sessionService;
     this.encryptionService = encryptionService;
 }
        public SessionFactoryHolderFactory(
            ShellSettings shellSettings,
            ShellBlueprint shellBlueprint,
            IDataServicesProviderFactory dataServicesProviderFactory,
            IAppDataFolder appDataFolder,
            ISessionConfigurationCache sessionConfigurationCache,
            IHostEnvironment hostEnvironment,
            IDatabaseCacheConfiguration cacheConfiguration,
            Func<IEnumerable<ISessionConfigurationEvents>> configurers,
            IRepository<ConnectionsRecord> connectionsRecordRepository,
            IEncryptionService encryptionService,
            ICacheManager cacheManager)
        {
            _shellSettings = shellSettings;
            _shellBlueprint = shellBlueprint;
            _dataServicesProviderFactory = dataServicesProviderFactory;
            _appDataFolder = appDataFolder;
            _sessionConfigurationCache = sessionConfigurationCache;
            _hostEnvironment = hostEnvironment;
            _cacheConfiguration = cacheConfiguration;
            _configurers = configurers;
            _connectionsRecordRepository = connectionsRecordRepository;
            _encryptionService = encryptionService;
            _cacheManager = cacheManager;

            T = NullLocalizer.Instance;
            Logger = NullLogger.Instance;
        }
コード例 #9
0
 public TwitterOAuthService(IEncryptionService oauthHelper, IQuickLogOnService quickLogOnService)
 {
     T = NullLocalizer.Instance;
     Logger = NullLogger.Instance;
     _quickLogOnService = quickLogOnService;
     _oauthHelper = oauthHelper;
 }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AuthenticationController"/> class.
 /// </summary>
 /// <param name="userDataMapper">
 /// The user Data Mapper.
 /// </param>
 /// <param name="encryptionService">
 /// The encryption service.
 /// </param>
 public AuthenticationController(
     IUserDataMapper userDataMapper, 
     IEncryptionService encryptionService)
 {
     _userDataMapper = userDataMapper;
     _encryptionService = encryptionService;
 }
コード例 #11
0
 public AuthenticationService(ITenantRepository tenantRepository, IUserRepository userRepository,
     IEncryptionService encryptionService)
 {
     this._tenantRepository = tenantRepository;
     this._userRepository = userRepository;
     this._encryptionService = encryptionService;
 }
コード例 #12
0
 public SettingController(ISettingService settingService,
     ICountryService countryService, IStateProvinceService stateProvinceService,
     IAddressService addressService, ITaxCategoryService taxCategoryService,
     ICurrencyService currencyService, IPictureService pictureService, 
     ILocalizationService localizationService, IDateTimeHelper dateTimeHelper,
     IOrderService orderService, IEncryptionService encryptionService,
     IThemeProvider themeProvider, ICustomerService customerService, 
     ICustomerActivityService customerActivityService, IPermissionService permissionService,
     IWebHelper webHelper, IFulltextService fulltextService, 
     IMaintenanceService maintenanceService, IStoreService storeService,
     IWorkContext workContext, IGenericAttributeService genericAttributeService)
 {
     this._settingService = settingService;
     this._countryService = countryService;
     this._stateProvinceService = stateProvinceService;
     this._addressService = addressService;
     this._taxCategoryService = taxCategoryService;
     this._currencyService = currencyService;
     this._pictureService = pictureService;
     this._localizationService = localizationService;
     this._dateTimeHelper = dateTimeHelper;
     this._orderService = orderService;
     this._encryptionService = encryptionService;
     this._themeProvider = themeProvider;
     this._customerService = customerService;
     this._customerActivityService = customerActivityService;
     this._permissionService = permissionService;
     this._webHelper = webHelper;
     this._fulltextService = fulltextService;
     this._maintenanceService = maintenanceService;
     this._storeService = storeService;
     this._workContext = workContext;
     this._genericAttributeService = genericAttributeService;
 }
コード例 #13
0
        public override void SetUp()
        {
            base.SetUp();

            userRepository = mockery.DynamicMock<IRepository<MembraneUser>>();
            encryptionService = mockery.DynamicMock<IEncryptionService>();
            service = new AuthenticationService(userRepository, encryptionService);
        }
コード例 #14
0
   public RegistrationService(IUserService userService, IAuthenticationService authService,
 IRoleService roleService, IEncryptionService encryptionService)
   {
       _userService = userService;
         _authService = authService;
         _roleService = roleService;
         _encryptionService = encryptionService;
   }
コード例 #15
0
ファイル: UserService.cs プロジェクト: kerrjon/MNFathers
 public UserService(IContentManager contentManager, IMembershipService membershipService, IClock clock, IMessageManager messageManager, ShellSettings shellSettings, IEncryptionService encryptionService) {
     _contentManager = contentManager;
     _membershipService = membershipService;
     _clock = clock;
     _messageManager = messageManager;
     _encryptionService = encryptionService;
     Logger = NullLogger.Instance;
 }
コード例 #16
0
 public MembershipService(IEntityBaseRepository<User> userRepository, IEntityBaseRepository<Role> roleRepository, IEntityBaseRepository<UserRole> userRoleRepository, IEncryptionService encryptionService, UnitOfWork unitOfWork)
 {
     _userRepository = userRepository;
     _roleRepository = roleRepository;
     _userRoleRepository = userRoleRepository;
     _encryptionService = encryptionService;
     _unitOfWork = unitOfWork;
 }
コード例 #17
0
 public new void SetUp() 
 {
     _securitySettings = new SecuritySettings()
     {
         EncryptionKey = "273ece6f97dd844d"
     };
     _encryptionService = new EncryptionService(_securitySettings);
 }
コード例 #18
0
 public MembershipService(IUserRepository userRepository, IRoleRepository roleRepository,
 IUserRoleRepository userRoleRepository, IEncryptionService encryptionService)
 {
     _userRepository = userRepository;
     _roleRepository = roleRepository;
     _userRoleRepository = userRoleRepository;
     _encryptionService = encryptionService;
 }
コード例 #19
0
 public MembershipService(IOrchardServices orchardServices, IMessageManager messageManager, IEnumerable<IUserEventHandler> userEventHandlers, IClock clock, IEncryptionService encryptionService) {
     _orchardServices = orchardServices;
     _messageManager = messageManager;
     _userEventHandlers = userEventHandlers;
     _encryptionService = encryptionService;
     Logger = NullLogger.Instance;
     T = NullLocalizer.Instance;
 }
コード例 #20
0
        public AuthenticationService(IRepository<MembraneUser> userRepository, IEncryptionService encryptionService)
        {
            GuardAgainst.ArgumentNull(userRepository, "userRepository");
            GuardAgainst.ArgumentNull(encryptionService, "encryptionService");

            this.userRepository = userRepository;
            this.encryptionService = encryptionService;
        }
コード例 #21
0
        public SmtpSettingsPartHandler(IRepository<SmtpSettingsPartRecord> repository, IEncryptionService encryptionService) {
            T = NullLocalizer.Instance;
            _encryptionService = encryptionService;
            Filters.Add(new ActivatingFilter<SmtpSettingsPart>("Site"));
            Filters.Add(StorageFilter.For(repository));

            OnLoaded<SmtpSettingsPart>(LazyLoadHandlers);
        }
コード例 #22
0
        public ViewModel(ISerializer serializer)
        {
            _serializer = serializer;
            _unencryptedService = new UnencryptedService();
            _encryptedService = EncryptionService.Create();

            _loadCommand = new RelayCommand(LoadAction);
            _saveCommand = new RelayCommand(SaveAction);
        }
コード例 #23
0
ファイル: UsersController.cs プロジェクト: haiconmot/SmsQuiz
 /// <summary>
 /// Initializes a new instance of the <see cref="UsersController"/> class.
 /// </summary>
 /// <param name="userDataMapper">
 /// The user repository.
 /// </param>
 /// <param name="mapper">
 /// The mapper.
 /// </param>
 /// <param name="encryptionService">
 /// The encryption service.
 /// </param>
 public UsersController(
     IUserDataMapper userDataMapper, 
     IMapper mapper,        
     IEncryptionService encryptionService)
 {
     _userDataMapper = userDataMapper;
     _mapper = mapper;
     _encryptionService = encryptionService;
 }
        public SyntaxHighlighterSettingsPartHandler(IRepository<SyntaxHighlighterSettingsPartRecord> repository, IEncryptionService encryptionService)
        {
            T = NullLocalizer.Instance;
            Logger = NullLogger.Instance;

            _encryptionService = encryptionService;
            Filters.Add(new ActivatingFilter<SyntaxHighlighterSettingsPart>("Site"));
            Filters.Add(StorageFilter.For(repository));
        }
コード例 #25
0
 public OrchardOpenAuthWebSecurity(IOpenAuthSecurityManagerWrapper openAuthSecurityManagerWrapper,
                                   IUserProviderServices userProviderServices,
                                   IOrchardOpenAuthClientProvider orchardOpenAuthClientProvider,
                                   IEncryptionService encryptionService) {
     _openAuthSecurityManagerWrapper = openAuthSecurityManagerWrapper;
     _userProviderServices = userProviderServices;
     _orchardOpenAuthClientProvider = orchardOpenAuthClientProvider;
     _encryptionService = encryptionService;
 }
コード例 #26
0
ファイル: CommentService.cs プロジェクト: kanujhun/orchard
 public CommentService(
     IOrchardServices orchardServices, 
     IClock clock, 
     IEncryptionService encryptionService) {
     _orchardServices = orchardServices;
     _clock = clock;
     _encryptionService = encryptionService;
     Logger = NullLogger.Instance;
 }
コード例 #27
0
ファイル: Encrypt.cs プロジェクト: Erikvl87/Premotion-Mansion
		/// <summary>
		/// Constructs the <see cref="Encrypt"/> function.
		/// </summary>
		/// <param name="encryptionService">The <see cref="IEncryptionService"/>.</param>
		/// <exception cref="ArgumentNullException">Thrown if one of the parameters is null.</exception>
		public Encrypt(IEncryptionService encryptionService)
		{
			// validate arguments
			if (encryptionService == null)
				throw new ArgumentNullException("encryptionService");

			// set values
			this.encryptionService = encryptionService;
		}
コード例 #28
0
 public MembershipService(IUserRepository userRepository, IRoleRepository roleRepository,
 IUserRoleRepository userRoleRepository, IEncryptionService encryptionService, IUnitOfWork unitOfWork)
 {
     _userRepository = userRepository;
     _roleRepository = roleRepository;
     _userRoleRepository = userRoleRepository;
     _encryptionService = encryptionService;
     _unitOfWork = unitOfWork;
 }
コード例 #29
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="userService">User service</param>
 /// <param name="encryptionService">Encryption service</param>
 /// <param name="localizationService">Localization service</param>
 /// <param name="userSettings">User settings</param>
 public UserRegistrationService(IUserService userService, 
     IEncryptionService encryptionService, 
     ILocalizationService localizationService,
     UserSettings userSettings)
 {
     this._userService = userService;
     this._encryptionService = encryptionService;
     this._localizationService = localizationService;
     this._userSettings = userSettings;
 }
コード例 #30
0
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="customerService">Customer service</param>
 /// <param name="encryptionService">Encryption service</param>
 /// <param name="newsLetterSubscriptionService">Newsletter subscription service</param>
 /// <param name="localizationService">Localization service</param>
 /// <param name="storeService">Store service</param>
 /// <param name="rewardPointsSettings">Reward points settings</param>
 /// <param name="customerSettings">Customer settings</param>
 public CustomerRegistrationService(ICustomerService customerService,
     IEncryptionService encryptionService,
     ILocalizationService localizationService,
     CustomerSettings customerSettings)
 {
     this._customerService = customerService;
     this._encryptionService = encryptionService;
     this._localizationService = localizationService;
     this._customerSettings = customerSettings;
 }
コード例 #31
0
 public EncryptionController(IEncryptionService encryptionService)
 {
     _encryptionService = encryptionService;
 }
コード例 #32
0
 public FrequencyAdapter(IEncryptionService encryptionService)
 {
     _encryptionService = encryptionService;
 }
コード例 #33
0
        public new void SetUp()
        {
            _workContext = null;

            _store = new Store()
            {
                Id = 1
            };
            _storeContext = MockRepository.GenerateMock <IStoreContext>();
            _storeContext.Expect(x => x.CurrentStore).Return(_store);

            var pluginFinder = new PluginFinder();
            var cacheManager = new NullCache();

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();

            //price calculation service
            _discountService         = MockRepository.GenerateMock <IDiscountService>();
            _categoryService         = MockRepository.GenerateMock <ICategoryService>();
            _productAttributeParser  = MockRepository.GenerateMock <IProductAttributeParser>();
            _productAttributeService = MockRepository.GenerateMock <IProductAttributeService>();
            _eventPublisher          = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _localizationService = MockRepository.GenerateMock <ILocalizationService>();
            _settingService      = MockRepository.GenerateMock <ISettingService>();

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = MockRepository.GenerateMock <IRepository <ShippingMethod> >();
            _logger          = new NullLogger();
            _shippingService = new ShippingService(cacheManager,
                                                   _shippingMethodRepository,
                                                   _logger,
                                                   _productAttributeParser,
                                                   _productService,
                                                   _checkoutAttributeParser,
                                                   _genericAttributeService,
                                                   _localizationService,
                                                   _shippingSettings, pluginFinder,
                                                   _eventPublisher, _shoppingCartSettings,
                                                   _settingService,
                                                   this.ProviderManager);
            _shipmentService = MockRepository.GenerateMock <IShipmentService>();


            _paymentService          = MockRepository.GenerateMock <IPaymentService>();
            _checkoutAttributeParser = MockRepository.GenerateMock <ICheckoutAttributeParser>();
            _giftCardService         = MockRepository.GenerateMock <IGiftCardService>();
            _genericAttributeService = MockRepository.GenerateMock <IGenericAttributeService>();

            //tax
            _taxSettings = new TaxSettings();
            _taxSettings.ShippingIsTaxable = true;
            _taxSettings.PaymentMethodAdditionalFeeIsTaxable = true;
            _taxSettings.DefaultTaxAddressId = 10;

            _addressService = MockRepository.GenerateMock <IAddressService>();
            _addressService.Expect(x => x.GetAddressById(_taxSettings.DefaultTaxAddressId)).Return(new Address()
            {
                Id = _taxSettings.DefaultTaxAddressId
            });
            _downloadService  = MockRepository.GenerateMock <IDownloadService>();
            _commonServices   = MockRepository.GenerateMock <ICommonServices>();
            _httpRequestBase  = MockRepository.GenerateMock <HttpRequestBase>();
            _geoCountryLookup = MockRepository.GenerateMock <IGeoCountryLookup>();

            _taxService = new TaxService(_addressService, _workContext, _taxSettings, _shoppingCartSettings, pluginFinder, _settingService, _geoCountryLookup, this.ProviderManager);

            _rewardPointsSettings = new RewardPointsSettings();

            _priceCalcService = new PriceCalculationService(_discountService, _categoryService, _productAttributeParser, _productService, _shoppingCartSettings, _catalogSettings,
                                                            _productAttributeService, _downloadService, _commonServices, _httpRequestBase, _taxService);

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService,
                                                                      _genericAttributeService,
                                                                      _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);

            _orderService               = MockRepository.GenerateMock <IOrderService>();
            _webHelper                  = MockRepository.GenerateMock <IWebHelper>();
            _languageService            = MockRepository.GenerateMock <ILanguageService>();
            _productService             = MockRepository.GenerateMock <IProductService>();
            _priceFormatter             = MockRepository.GenerateMock <IPriceFormatter>();
            _productAttributeFormatter  = MockRepository.GenerateMock <IProductAttributeFormatter>();
            _shoppingCartService        = MockRepository.GenerateMock <IShoppingCartService>();
            _checkoutAttributeFormatter = MockRepository.GenerateMock <ICheckoutAttributeFormatter>();
            _customerService            = MockRepository.GenerateMock <ICustomerService>();
            _encryptionService          = MockRepository.GenerateMock <IEncryptionService>();
            _workflowMessageService     = MockRepository.GenerateMock <IWorkflowMessageService>();
            _customerActivityService    = MockRepository.GenerateMock <ICustomerActivityService>();
            _currencyService            = MockRepository.GenerateMock <ICurrencyService>();
            _affiliateService           = MockRepository.GenerateMock <IAffiliateService>();

            _paymentSettings = new PaymentSettings()
            {
                ActivePaymentMethodSystemNames = new List <string>()
                {
                    "Payments.TestMethod"
                }
            };
            _orderSettings = new OrderSettings();

            _localizationSettings = new LocalizationSettings();

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _currencySettings = new CurrencySettings();

            _orderProcessingService = new OrderProcessingService(_orderService, _webHelper,
                                                                 _localizationService, _languageService,
                                                                 _productService, _paymentService, _logger,
                                                                 _orderTotalCalcService, _priceCalcService, _priceFormatter,
                                                                 _productAttributeParser, _productAttributeFormatter,
                                                                 _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                                                                 _shippingService, _shipmentService, _taxService,
                                                                 _customerService, _discountService,
                                                                 _encryptionService, _workContext, _storeContext, _workflowMessageService,
                                                                 _customerActivityService, _currencyService, _affiliateService,
                                                                 _eventPublisher, _genericAttributeService,
                                                                 _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings,
                                                                 _currencySettings, _shoppingCartSettings);
        }
コード例 #34
0
 public static string Cleartext(this IEncryptionService service, string ciphertext)
 {
     return(service.Decode(ciphertext.FromBase64String()).GetString());
 }
コード例 #35
0
 public UserService(IUserManager userManager, IEncryptionService encryptionService)
 {
     _userManager       = userManager;
     _encryptionService = encryptionService;
 }
コード例 #36
0
ファイル: ApiService.cs プロジェクト: truedeity/playground
        public ApiService(ISettingsProvider settingsProvider, IDataService dataService, IEncryptionService encryptionService)
        {
            _settingsProvider = settingsProvider;

            _dataService       = dataService;
            _encryptionService = encryptionService;
        }
コード例 #37
0
        private static async Task <string> _ResolveEncryptedQueryStringParameterValueAsync(this HttpContext context, object routeValues,
                                                                                           IEncryptionService encryptionService)
        {
            var sb = new StringBuilder();

            if (routeValues != null)
            {
                var d = new RouteValueDictionary(routeValues);
                for (var i = 0; i < d.Keys.Count; i++)
                {
                    if (i > 0)
                    {
                        sb.Append("&");
                    }

                    sb.Append($"{d.Keys.ElementAt(i)}={d.Values.ElementAt(i)}");
                }
            }

            var result = string.Empty;

            if (sb.Length > 0 && (ResolveEncryptionSettings(context)?.EncryptUrls ?? false))
            {
                result = Uri.EscapeDataString(await encryptionService.EncryptAsync(sb.ToString(), true));
            }
            else
            {
                result = sb.ToString();
            }

            return(result);
        }
コード例 #38
0
 public WireEncryptedMessageConvertor(IEncryptionService encryptionService)
 {
     EncryptionService = encryptionService;
 }
コード例 #39
0
 public MembershipService(IEncryptionService encryptionService, IUserRepository userRepository, TokenAuthOptions tokenOptions)
 {
     _encryptionService = encryptionService;
     _userRepository    = userRepository;
     _tokenOptions      = tokenOptions;
 }
コード例 #40
0
 public AuthService(ApplicationDbContext context, IEncryptionService crypto)
 {
     _context = context;
     _crypto  = crypto;
 }
コード例 #41
0
 public SignalService(IEncryptionService encryptionService)
 {
     _encryptionService = encryptionService;
 }
コード例 #42
0
        public void TestInitialize()
        {
            _workContext = null;

            _store = new Store {
                Id = "1"
            };
            var tempStoreContext = new Mock <IStoreContext>();
            {
                tempStoreContext.Setup(x => x.CurrentStore).Returns(_store);
                _storeContext = tempStoreContext.Object;
            }

            var pluginFinder = new PluginFinder(_serviceProvider);

            _shoppingCartSettings = new ShoppingCartSettings();
            _catalogSettings      = new CatalogSettings();

            var tempEventPublisher = new Mock <IMediator>();
            {
                //tempEventPublisher.Setup(x => x.PublishAsync(It.IsAny<object>()));
                _eventPublisher = tempEventPublisher.Object;
            }
            var cacheManager = new TestMemoryCacheManager(new Mock <IMemoryCache>().Object, _eventPublisher);

            _productService = new Mock <IProductService>().Object;

            //price calculation service
            _discountService           = new Mock <IDiscountService>().Object;
            _categoryService           = new Mock <ICategoryService>().Object;
            _manufacturerService       = new Mock <IManufacturerService>().Object;
            _customerService           = new Mock <ICustomerService>().Object;
            _productReservationService = new Mock <IProductReservationService>().Object;
            _currencyService           = new Mock <ICurrencyService>().Object;
            _auctionService            = new Mock <IAuctionService>().Object;
            _serviceProvider           = new Mock <IServiceProvider>().Object;
            _stateProvinceService      = new Mock <IStateProvinceService>().Object;

            _productAttributeParser = new Mock <IProductAttributeParser>().Object;
            _priceCalcService       = new PriceCalculationService(_workContext, _storeContext,
                                                                  _discountService, _categoryService, _manufacturerService,
                                                                  _productAttributeParser, _productService, _customerService,
                                                                  _vendorService, _currencyService, _shoppingCartSettings, _catalogSettings);



            _localizationService = new Mock <ILocalizationService>().Object;

            //shipping
            _shippingSettings = new ShippingSettings();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>();
            _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod");
            _shippingMethodRepository = new Mock <IRepository <ShippingMethod> >().Object;
            _deliveryDateRepository   = new Mock <IRepository <DeliveryDate> >().Object;
            _warehouseRepository      = new Mock <IRepository <Warehouse> >().Object;

            _logger          = new NullLogger();
            _shippingService = new ShippingService(_shippingMethodRepository,
                                                   _deliveryDateRepository,
                                                   _warehouseRepository,
                                                   null,
                                                   _logger,
                                                   _productService,
                                                   _productAttributeParser,
                                                   _checkoutAttributeParser,
                                                   _localizationService,
                                                   _addressService,
                                                   _countryService,
                                                   _stateProvinceService,
                                                   pluginFinder,
                                                   _storeContext,
                                                   _eventPublisher,
                                                   _currencyService,
                                                   cacheManager,
                                                   null,
                                                   _shoppingCartSettings,
                                                   _shippingSettings);
            _shipmentService = new Mock <IShipmentService>().Object;

            tempPaymentService = new Mock <IPaymentService>();
            {
                _paymentService = tempPaymentService.Object;
            }
            _checkoutAttributeParser = new Mock <ICheckoutAttributeParser>().Object;
            _giftCardService         = new Mock <IGiftCardService>().Object;
            _genericAttributeService = new Mock <IGenericAttributeService>().Object;

            _geoLookupService = new Mock <IGeoLookupService>().Object;
            _countryService   = new Mock <ICountryService>().Object;
            _customerSettings = new CustomerSettings();
            _addressSettings  = new AddressSettings();

            //tax
            _taxSettings = new TaxSettings
            {
                ShippingIsTaxable = true,
                PaymentMethodAdditionalFeeIsTaxable = true,
                DefaultTaxAddressId = "10"
            };

            var tempAddressService = new Mock <IAddressService>();

            {
                tempAddressService.Setup(x => x.GetAddressByIdSettings(_taxSettings.DefaultTaxAddressId))
                .ReturnsAsync(new Address {
                    Id = _taxSettings.DefaultTaxAddressId
                });
                _addressService = tempAddressService.Object;
            }

            _taxService = new TaxService(_addressService, _workContext, _taxSettings,
                                         pluginFinder, _geoLookupService, _countryService, _serviceProvider, _logger, _customerSettings, _addressSettings);

            _rewardPointsSettings = new RewardPointsSettings();

            _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext,
                                                                      _priceCalcService, _taxService, _shippingService, _paymentService,
                                                                      _checkoutAttributeParser, _discountService, _giftCardService,
                                                                      null, _productService, _currencyService,
                                                                      _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings);

            _orderService               = new Mock <IOrderService>().Object;
            _webHelper                  = new Mock <IWebHelper>().Object;
            _languageService            = new Mock <ILanguageService>().Object;
            _priceFormatter             = new Mock <IPriceFormatter>().Object;
            _productAttributeFormatter  = new Mock <IProductAttributeFormatter>().Object;
            _shoppingCartService        = new Mock <IShoppingCartService>().Object;
            _checkoutAttributeFormatter = new Mock <ICheckoutAttributeFormatter>().Object;
            _encryptionService          = new Mock <IEncryptionService>().Object;
            _workflowMessageService     = new Mock <IWorkflowMessageService>().Object;
            _customerActivityService    = new Mock <ICustomerActivityService>().Object;
            _currencyService            = new Mock <ICurrencyService>().Object;
            _affiliateService           = new Mock <IAffiliateService>().Object;
            _vendorService              = new Mock <IVendorService>().Object;
            _pdfService                 = new Mock <IPdfService>().Object;

            _paymentSettings = new PaymentSettings
            {
                ActivePaymentMethodSystemNames = new List <string>
                {
                    "Payments.TestMethod"
                }
            };
            _orderSettings        = new OrderSettings();
            _localizationSettings = new LocalizationSettings();
            ICustomerActionEventService tempICustomerActionEventService = new Mock <ICustomerActionEventService>().Object;

            _orderProcessingService = new OrderProcessingService(_orderService, _webHelper,
                                                                 _localizationService, _languageService,
                                                                 _productService, _paymentService, _logger,
                                                                 _orderTotalCalcService, _priceCalcService, _priceFormatter,
                                                                 _productAttributeParser, _productAttributeFormatter,
                                                                 _giftCardService, _shoppingCartService, _checkoutAttributeFormatter,
                                                                 _shippingService, _shipmentService, _taxService,
                                                                 _customerService, _discountService,
                                                                 _encryptionService, _workContext,
                                                                 _workflowMessageService, _vendorService,
                                                                 _customerActivityService, tempICustomerActionEventService,
                                                                 _currencyService, _affiliateService,
                                                                 _eventPublisher, _pdfService, null, _storeContext, _productReservationService, _auctionService, _countryService,
                                                                 _shippingSettings, _shoppingCartSettings, _paymentSettings, _rewardPointsSettings,
                                                                 _orderSettings, _taxSettings, _localizationSettings);
        }
コード例 #43
0
 public AuthenticateHandler(IBacklogContext context, IEncryptionService encryptionService)
 {
     _encryptionService = encryptionService;
     _context           = context;
 }
コード例 #44
0
 public MembershipService(IEntityBaseRepository <User> userRepository, IEntityBaseRepository <Role> roleRepository,
                          IEntityBaseRepository <UserRole> userRoleRepository, IEncryptionService encryptionService, IUnitOfWork unitOfWork)
 {
     _userRepository     = userRepository;
     _roleRepository     = roleRepository;
     _userRoleRepository = userRoleRepository;
     _encryptionService  = encryptionService;
     _unitOfWork         = unitOfWork;
 }
コード例 #45
0
        public async Task <IActionResult> Login([FromServices] IEncryptionService _encryptionService,
                                                [FromServices] SystemContext adminDbContext,
                                                [Bind("Email,Password")] LoginViewModel loginViewModel, string returnUrl)
        {
            if (HttpContext.User.Identity.IsAuthenticated)
            {
                return(RedirectToLocal(returnUrl));
            }

            if (ModelState.IsValid)
            {
                var result = Microsoft.AspNetCore.Identity.SignInResult.Failed;

                var account = adminDbContext.Accounts.FirstOrDefault(x => x.NormalizedEmail == loginViewModel.Email.ToUpper());
                if (account != null)
                {
                    string pwd      = "";
                    string password = loginViewModel.Password;
                    switch (account.PasswordFormat)
                    {
                    case PasswordFormat.Encrypted:
                        pwd = _encryptionService.EncryptText(password);
                        break;

                    case PasswordFormat.Hashed:
                        pwd = _encryptionService.CreatePasswordHash(password, account.PasswordSalt, HashedPasswordFormat);
                        break;

                    default:
                        pwd = password;
                        break;
                    }

                    bool isValid = pwd == account.Password;
                    if (isValid)
                    {
                        result = Microsoft.AspNetCore.Identity.SignInResult.Success;
                    }
                }

                if (result.Succeeded)
                {
                    if (result.RequiresTwoFactor)
                    {
                        //return RedirectToAction(nameof(LoginWith2fa), new { returnUrl, rememberMe = false });
                        //
                    }
                    else if (result.IsLockedOut)
                    {
                        //_logger.LogWarning("User account locked out.");
                    }
                    else
                    {
                        var applicationUser = new ApplicationUser()
                        {
                            Name        = account.Email,
                            Sysid       = account.Sysid,
                            AccountType = account.AccountType,
                            TenantId    = account.TenantId
                        };
                        await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme,
                                                      await _userClaimsPrincipalFactory.CreateAsync(applicationUser),
                                                      new AuthenticationProperties
                        {
                            IsPersistent = true,
                            IssuedUtc    = DateTime.UtcNow,
                            ExpiresUtc   = DateTime.MaxValue.ToUniversalTime()
                        });

                        return(RedirectToLocal(returnUrl));
                    }
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Invalid login attempt.");
                }
            }

            return(View(loginViewModel));
        }
コード例 #46
0
 public AuthorizeNetPaymentProcessor(AuthorizeNetPaymentSettings authorizeNetPaymentSettings,
                                     ISettingService settingService,
                                     ICurrencyService currencyService,
                                     ICustomerService customerService,
                                     CurrencySettings currencySettings, IWebHelper webHelper,
                                     IOrderTotalCalculationService orderTotalCalculationService, IEncryptionService encryptionService)
 {
     this._authorizeNetPaymentSettings = authorizeNetPaymentSettings;
     this._settingService               = settingService;
     this._currencyService              = currencyService;
     this._customerService              = customerService;
     this._currencySettings             = currencySettings;
     this._webHelper                    = webHelper;
     this._orderTotalCalculationService = orderTotalCalculationService;
     this._encryptionService            = encryptionService;
 }
コード例 #47
0
        public async Task <IActionResult> Register([FromServices] IEncryptionService _encryptionService,
                                                   [FromServices] SystemContext agileLabsDbContext,
                                                   [Bind] RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var account = new Account()
                {
                    Email           = model.Email,
                    NormalizedEmail = model.Email.ToUpper(),
                    AccountType     = AccountType.Tenant
                };

                account.PasswordFormat = model.PasswordFormat;

                switch (model.PasswordFormat)
                {
                case PasswordFormat.Clear:
                {
                    account.Password = model.Password;
                }
                break;

                case PasswordFormat.Encrypted:
                {
                    account.Password = _encryptionService.EncryptText(model.Password);
                }
                break;

                case PasswordFormat.Hashed:
                {
                    string saltKey = _encryptionService.CreateSaltKey(5);
                    account.PasswordSalt = saltKey;
                    account.Password     = _encryptionService.CreatePasswordHash(model.Password, saltKey, HashedPasswordFormat);
                }
                break;

                default:
                    break;
                }

                #region Tenant Handle
                var tenant = new Tenant()
                {
                    Name = $"Tenant-{account.Email.Substring(0, account.Email.IndexOf("@"))}"
                };
                account.TenantId = tenant.Sysid;
                #endregion

                using (var trans = agileLabsDbContext.Database.BeginTransaction())
                {
                    var emailCheckResult = agileLabsDbContext.Accounts.FirstOrDefault(x => x.NormalizedEmail == account.NormalizedEmail) == null;
                    if (emailCheckResult)
                    {
                        agileLabsDbContext.Add(tenant);

                        agileLabsDbContext.Add(account);

                        await agileLabsDbContext.SaveChangesAsync();

                        trans.Commit();
                        return(RedirectToAction(nameof(Login)));
                    }
                    else
                    {
                        ModelState.AddModelError(nameof(RegisterViewModel.Email), "Duplicated Email");
                    }
                }
            }

            return(View(model));
        }
コード例 #48
0
 public EncryptedTokenCodeService(string unregisteredGuid, IEncryptionService encryptionService)
 {
     _unregisteredGuid  = unregisteredGuid ?? throw new ArgumentNullException(nameof(unregisteredGuid));
     _encryptionService = encryptionService ?? throw new ArgumentNullException(nameof(encryptionService));
 }
コード例 #49
0
 public MailAccountService(IRnLogger logger, IMailAccountRepo repo, IEncryptionService encryptionService)
 {
     _logger            = logger;
     _repo              = repo;
     _encryptionService = encryptionService;
 }
コード例 #50
0
 public UserRepository(HWBTournamentContext context, IRoleRepository roleRepository, IUserRoleRepository userRoleRepository, IEncryptionService encryptionService)
     : base(context)
 {
     _roleRepository     = roleRepository;
     _userRoleRepository = userRoleRepository;
     _encryptionService  = encryptionService;
 }
コード例 #51
0
ファイル: UserService.cs プロジェクト: 206039/FileEditorApp
 public UserService(IUserRepository userRepository, IEncryptionService encryptionService, IJwtHandler jwtHandler)
 {
     _userRepository    = userRepository;
     _encryptionService = encryptionService;
     _jwtHandler        = jwtHandler;
 }
コード例 #52
0
        public new void SetUp()
        {
            _customerSettings = new CustomerSettings();
            _securitySettings = new SecuritySettings()
            {
                EncryptionKey = "273ece6f97dd844d"
            };
            _rewardPointsSettings = new RewardPointsSettings()
            {
                Enabled = false,
            };

            _encryptionService = new EncryptionService(_securitySettings);
            _customerRepo      = MockRepository.GenerateMock <IRepository <Customer> >();
            var customer1 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Hashed,
                Active         = true
            };

            string saltKey  = _encryptionService.CreateSaltKey(5);
            string password = _encryptionService.CreatePasswordHash("password", saltKey);

            customer1.PasswordSalt = saltKey;
            customer1.Password     = password;
            AddCustomerToRegisteredRole(customer1);

            var customer2 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer2);

            var customer3 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Encrypted,
                Password       = _encryptionService.EncryptText("password"),
                Active         = true
            };

            AddCustomerToRegisteredRole(customer3);

            var customer4 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            AddCustomerToRegisteredRole(customer4);

            var customer5 = new Customer()
            {
                Username       = "******",
                Email          = "*****@*****.**",
                PasswordFormat = PasswordFormat.Clear,
                Password       = "******",
                Active         = true
            };

            _eventPublisher = MockRepository.GenerateMock <IEventPublisher>();
            _eventPublisher.Expect(x => x.Publish(Arg <object> .Is.Anything));

            _customerRepo.Expect(x => x.Table).Return(new List <Customer>()
            {
                customer1, customer2, customer3, customer4, customer5
            }.AsQueryable());

            _customerRoleRepo     = MockRepository.GenerateMock <IRepository <CustomerRole> >();
            _genericAttributeRepo = MockRepository.GenerateMock <IRepository <GenericAttribute> >();
            _orderRepo            = MockRepository.GenerateMock <IRepository <Order> >();
            _forumPostRepo        = MockRepository.GenerateMock <IRepository <ForumPost> >();
            _forumTopicRepo       = MockRepository.GenerateMock <IRepository <ForumTopic> >();

            _genericAttributeService       = MockRepository.GenerateMock <IGenericAttributeService>();
            _newsLetterSubscriptionService = MockRepository.GenerateMock <INewsLetterSubscriptionService>();

            _localizationService = MockRepository.GenerateMock <ILocalizationService>();
            _customerService     = new CustomerService(new NopNullCache(), _customerRepo, _customerRoleRepo,
                                                       _genericAttributeRepo, _orderRepo, _forumPostRepo, _forumTopicRepo,
                                                       null, null, null, null, null,
                                                       _genericAttributeService, _eventPublisher, _customerSettings);
            _customerRegistrationService = new CustomerRegistrationService(_customerService,
                                                                           _encryptionService, _newsLetterSubscriptionService, _localizationService,
                                                                           _rewardPointsSettings, _customerSettings);
        }
コード例 #53
0
 public void SetUp()
 {
     _customerService             = GetService <ICustomerService>();
     _encryptionService           = GetService <IEncryptionService>();
     _customerRegistrationService = GetService <ICustomerRegistrationService>();
 }
コード例 #54
0
 public MembershipService(IUserRepository userRepository, IRoleRepository roleRepository, IUserRoleRepository userRoleRepository, IEncryptionService encryptionService)
 {
     _userRepository     = userRepository;
     _roleRepository     = roleRepository;
     _userRoleRepository = userRoleRepository;
     _encryptionService  = encryptionService;
 }
コード例 #55
0
ファイル: AccountController.cs プロジェクト: AzaelFann/mtgen
 public AccountController(IEncryptionService encryptionService)
 {
     _encryptionService = encryptionService;
 }
コード例 #56
0
 public UserService(IRepository <User> userRepository, IEncryptionService encryptionService)
 {
     this.userRepository    = userRepository;
     this.encryptionService = encryptionService;
 }
コード例 #57
0
 public AccountService(IStorageService <User, string> storageService, IAuthenticationService authenticationService, IEncryptionService encryptionService)
 {
     _storageService        = storageService;
     _authenticationService = authenticationService;
     _encryptionService     = encryptionService;
 }
コード例 #58
0
 public LinkedInSettingsPartDriver(IEncryptionService service)
 {
     _service = service;
     T        = NullLocalizer.Instance;
 }
コード例 #59
0
 public UserRegistration(IEncryptionService encryptionService, IUserRepository userRepository, IUnitOfWork uow, INotifiable <DomainNotification> domainNotification)
     : base(uow, domainNotification)
 {
     _encryptionService = encryptionService;
     _userRepository    = userRepository;
 }
コード例 #60
0
 public UserRegistrationService(IUserRepository userRepository, IEncryptionService encryptionService, IRoleRepository roleRepository)
 {
     _userRepository    = userRepository;
     _encryptionService = encryptionService;
     _roleRepository    = roleRepository;
 }