public UserStateController(IUserStateManager userStateManager, INowProvider nowProvider, IAccountRepository accountRepository, ITimeWarpAuthenticationManager authenticationManager)
 {
     _userStateManager      = userStateManager;
     _nowProvider           = nowProvider;
     _accountRepository     = accountRepository;
     _authenticationManager = authenticationManager;
 }
 public JwtTokenExpireDateTimeProvider(
     IOptions <JwtTokenOptions> options,
     INowProvider nowProvider)
 {
     _nowProvider = nowProvider;
     _options     = options.Value;
 }
Example #3
0
 public UserMessageController(IUserMessageRepository userMessageRepository, ITimeWarpAuthenticationManager authenticationManager, IRoomRepository roomRepository, INowProvider nowProvider)
 {
     _userMessageRepository = userMessageRepository;
     _authenticationManager = authenticationManager;
     _roomRepository        = roomRepository;
     _nowProvider           = nowProvider;
 }
Example #4
0
        public IdentityServicesImpl(
            SignInManager <UserModel> signInManager,
            UserManager <UserModel> userManager,
            ILogger <IdentityServicesImpl> logger,
            IEmailSender emailSender,
            IEmailTemplateProvider emailTemplateProvider,
            IUrlHelper urlHelper,
            SqlServerIdentityDbContext identityDbContext,
            IConfigurationProvider configurationProvider,
            INowProvider nowProvider,
            IServiceProvider serviceProvider)
        {
            _signInManager         = signInManager;
            _userManager           = userManager;
            _logger                = logger;
            _emailSender           = emailSender;
            _emailTemplateProvider = emailTemplateProvider;
            _urlHelper             = urlHelper;
            _identityDbContext     = identityDbContext;
            _configurationProvider = configurationProvider;

            _nowProvider = nowProvider;

            _serviceProvider = serviceProvider;

            _tenantInfoAccessor = serviceProvider.GetService <ITenantInfoAccessor>();
        }
Example #5
0
 public RoomStateController(IUserStateManager userStateManager, IRoomRepository rooms, IRoomRemovalPolicy roomRemovalPolicy, INowProvider nowProvider)
 {
     _userStateManager  = userStateManager;
     _rooms             = rooms;
     _roomRemovalPolicy = roomRemovalPolicy;
     _nowProvider       = nowProvider;
 }
 public CreateEmptyListHandler(SharedListContext context, INowProvider nowProvider,
                               IRandomisedWordProvider randomisedWordProvider, IConfiguration configuration)
 {
     _context                = context;
     _nowProvider            = nowProvider;
     _randomisedWordProvider = randomisedWordProvider;
     _configuration          = configuration;
 }
Example #7
0
 public RoomInfoController(IRoomRepository roomRepository, IAccountRepository accounts, ITimeWarpAuthenticationManager authenticationManager,
                           INowProvider nowProvider)
 {
     _roomRepository        = roomRepository;
     _nowProvider           = nowProvider;
     _accounts              = accounts;
     _authenticationManager = authenticationManager;
 }
        public static async Task <DateTime> GetNowUtcAsync(this INowProvider nowProvider)
        {
            var now = await nowProvider.GetNowAsync();

            var nowUtc = now.ToUniversalTime();

            return(nowUtc);
        }
        public TimeWarpAuthenticationManager(IAuthenticationSessionRepository authenticationSessionRepository, IAccountPasswordRepository accountPasswords, INowProvider nowProvider)
        {
            _accountPasswords = accountPasswords;
            _nowProvider      = nowProvider;
            _log = LogManager.GetLogger(GetType());

            _sessionIdProvider = new SessionIdProvider();
            _authenticationSessionRepository = authenticationSessionRepository;
        }
 public UserToSService(Func <IInventContext> contextFactory,
                       INowProvider nowProvider,
                       IOptions <TermsOfServiceOptions> options,
                       Func <IInventContext, ISecurityUserProvider> securityUserProviderFactory)
 {
     _nowProvider    = nowProvider;
     _contextFactory = contextFactory;
     _options        = options.Value;
     _securityUserProviderFactory = securityUserProviderFactory;
 }
Example #11
0
 public LogCleaner(
     IFileSystem fileSystem,
     INowProvider nowProvider,
     ILogSettings logSettings,
     ILogger logger)
 {
     _fileSystem = fileSystem;
     NowProvider = nowProvider;
     LogSettings = logSettings;
     _logger     = logger;
 }
Example #12
0
        public RollingWindowRateLimiter(TimeSpan windowSize, int maxRequestsInWindow, INowProvider nowProvider)
        {
            if (maxRequestsInWindow < 1)
            {
                throw new ArgumentOutOfRangeException("max requests must be at least 1");
            }

            _nowProvider         = nowProvider ?? throw new ArgumentNullException(nameof(nowProvider));
            _window              = windowSize.Ticks;
            _maxRequestsInWindow = maxRequestsInWindow;
        }
Example #13
0
 public CaptchaValidationService(
     INowProvider nowProvider,
     IOptions <CaptchaOptions> options,
     IHttpContextAccessor contextAccessor,
     Func <IHttpClientProvider> httpClientProviderFactory)
 {
     _nowProvider               = nowProvider;
     _contextAccessor           = contextAccessor;
     _httpClientProviderFactory = httpClientProviderFactory;
     _options       = options.Value;
     _tokenLifespan = _options.TokenLifespanInMinutes;
 }
 public ApiService
 (
     IApiRepository repository,
     INowProvider nowProvider,
     ITagProvider tagProvider,
     ILogger <ApiService> logger
 )
 {
     _repository  = repository;
     _nowProvider = nowProvider;
     _tagProvider = tagProvider;
     _logger      = logger;
 }
Example #15
0
 public ProcessPaymentHandler(
     IAcquiringBank acquiringBank,
     INowProvider nowProvider,
     IMemoryCache cache,
     ILogger logger,
     CachingOptions cachingOptions,
     CheckoutPaymentAPIContext context)
 {
     _acquiringBank  = acquiringBank;
     _nowProvider    = nowProvider;
     _cache          = cache;
     _logger         = logger;
     _cachingOptions = cachingOptions;
     _context        = context;
 }
Example #16
0
        public ProcessPaymentValidator(INowProvider nowProvider)
        {
            // must have card number and it must be a valid one
            RuleFor(x => x.CardNumber)
            .NotEmpty().WithMessage("Card number required");

            When(x => !string.IsNullOrWhiteSpace(x.CardNumber), () =>
            {
                RuleFor(x => x.CardNumber)
                .Must(x => ValidCreditCard(x))
                .WithMessage("Card number invalid");
            });

            // must have expiry and it must be in the future
            RuleFor(x => x.Expiry)
            .NotEmpty().WithMessage("Expiry required");

            When(x => x.Expiry != null, () =>
            {
                RuleFor(x => x.Expiry.Year)
                .NotEmpty()
                .WithMessage("Expiry year required");

                RuleFor(x => x.Expiry.Month)
                .InclusiveBetween(1, 12)
                .WithMessage("Expiry month must be between 1 and 12");

                RuleFor(x => x.Expiry)
                .Must(x => new DateTime(x.Year, x.Month, 1).AddMonths(1).AddDays(-1) >= nowProvider.Now.Date)
                .When(x => x.Expiry.Year > 0 && x.Expiry.Month > 0 && x.Expiry.Month < 13)
                .WithMessage("Expiry invalid");
            });

            // must have amount and it must not be 0
            RuleFor(x => x.Amount)
            .GreaterThan(0)
            .WithMessage("Amount must be greater than 0");

            // must have a currency and it must be in the approved list
            RuleFor(x => x.Currency)
            .NotEmpty().WithMessage("Currency required")
            .Must(x => SupportedCurrencies().Contains(x)).WithMessage("ISO 4217 Currency code not recognised");

            // must have cvv and it must be 3 digits long
            RuleFor(x => x.CVV)
            .NotEmpty().WithMessage("CVV required");

            When(x => !string.IsNullOrWhiteSpace(x.CVV), () =>
            {
                RuleFor(x => x.CVV)
                .Length(3)
                .WithMessage("CVV must be 3 characters long");

                When(x => x.CVV.Length == 3, () =>
                {
                    RuleFor(x => x.CVV)
                    .Must(x => int.TryParse(x, out _))
                    .WithMessage("CVV must not contain letters or symbols");
                });
            });

            RuleFor(x => x.Owner)
            .NotEmpty().WithMessage("Owner required");
        }
Example #17
0
 public TimeWarpUserController(IUsers users, INowProvider nowProvider, ITimeWarpStatePersistence persistence)
 {
     _users       = users;
     _nowProvider = nowProvider;
     _persistence = persistence;
 }
 public AuthenticateHandler(IConfiguration configuration, INowProvider nowProvider)
 {
     _configuration = configuration;
     _nowProvider   = nowProvider;
 }
Example #19
0
 public UpdateListHandler(SharedListContext context, INowProvider nowProvider, IConfiguration configuration)
 {
     _context       = context;
     _nowProvider   = nowProvider;
     _configuration = configuration;
 }
Example #20
0
 public IdentityVerifierServiceGateway(INowProvider nowProvider)
 {
     _nowProvider = nowProvider;
 }
Example #21
0
        public static TestServer CreateServer <TStartup>(IConnectionStringProvider connectionStringProvider, INowProvider testNowProvider) where TStartup : class
        {
            var webHostBuilder = new WebHostBuilder()
                                 .UseStartup <TStartup>()
                                 .UseContentRoot(Directory.GetCurrentDirectory())
                                 .ConfigureServices(services =>
            {
                services.AddSingleton(connectionStringProvider);
                services.AddSingleton(testNowProvider);
            })
                                 //.ConfigureLogging((hostingContext, logging) =>
                                 //{
                                 //    logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
                                 //    logging.AddConsole();
                                 //    logging.AddDebug();
                                 //})
                                 .ConfigureAppConfiguration((builderContext, config) =>
            {
                var env = builderContext.HostingEnvironment;
                config.SetBasePath(env.ContentRootPath)
                .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)         //TODO OPTIONAL IS TRUE FOR NOW
                .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
                .AddEnvironmentVariables();
            });

            var server = new TestServer(webHostBuilder);

            return(server);
        }
Example #22
0
 public LogService(INowProvider nowProvider)
 {
     myNowProvider = nowProvider ?? throw new ArgumentNullException(nameof(nowProvider));
 }
 public CrawledProgressTimeoutStopCondition(TimeSpan waitTimeout, INowProvider nowProvider)
 {
     _waitTimeout = waitTimeout;
     _nowProvider = nowProvider ?? throw new ArgumentNullException(nameof(nowProvider));
 }