Esempio n. 1
0
        private void ArrangeAuthenticateUserTests()
        {
            _repositoryMock = new Mock <IRepository <User> >();
            _validatorMock  = new Mock <IValidator <LoginInputModel> >();

            var secretBytes = new byte[40];
            var rand        = new Random();

            rand.NextBytes(secretBytes);
            _authenticationHelper = new AuthenticationHelper(secretBytes);

            _authenticationHelper.CreatePasswordHash("Passw0rd", out var passwordHash, out var passwordSalt);

            _user = new User
            {
                Username     = "******",
                PasswordHash = passwordHash,
                PasswordSalt = passwordSalt,
                IsAdmin      = true
            };

            _repositoryMock.Setup(repo => repo.ReadByName(_user.Username)).Returns(_user);

            _userService = new UserService(_repositoryMock.Object, _authenticationHelper,
                                           _validatorMock.Object);
        }
Esempio n. 2
0
 public CardDecksController(
     ITableStorageContextFactory tableStorageContextFactory,
     IAuthenticationHelper authenticationHelper)
 {
     this.lazyTableStorageContext = new Lazy<ITableStorageContext>(() =>
         tableStorageContextFactory.CreateTableStorageContext(AzureTableNames.CARD, authenticationHelper.NameIdentifier));
 }
Esempio n. 3
0
 public QuizResultHandler(ITableStorageContextFactory tableStorageContextFactory, IAuthenticationHelper authenticationHelper)
 {
     this.authenticationHelper = authenticationHelper;
     this.lazyQuizCalendar = new Lazy<IQuizCalendar>(() => tableStorageContextFactory
         .CreateTableStorageContext(AzureTableNames.CARD, this.authenticationHelper.NameIdentifier)
         .UserConfigurations.GetByNameIdentifier().QuizCalendar);
 }
 public QuizResultsControllerFake( 
     ITableStorageContextFactory tableStorageContextFactory, 
     IQuizResultHandler quizResultHandler,
     IAuthenticationHelper authenticationHelper)
     : base(tableStorageContextFactory, quizResultHandler, authenticationHelper)
 {
 }
Esempio n. 5
0
        public TokenController(IUserRepository <User> repos, IAuthenticationHelper authService)

        {
            repository = repos;

            authenticationHelper = authService;
        }
Esempio n. 6
0
        public MainPageViewModel(ICharacterRepository repository, IAuthenticationHelper helper, INavigationService service)
        {
            _repository = repository;
            _helper     = helper;
            _service    = service;

            Characters = new ObservableCollection <CharacterViewModel>();

            DetailsPageCommand = new RelayCommand(o =>
            {
                _service.Navigate(typeof(CharacterPage), o);
            });
            SignInOutCommand = new RelayCommand(async o =>
            {
                if (_account != null)
                {
                    await _helper.SignOutAsync(_account);
                    _account = null;
                    Characters.Clear();
                }
                else
                {
                    _account = await _helper.SignInAsync();
                    if (_account != null)
                    {
                        await Initialize();
                    }
                }
            });
        }
Esempio n. 7
0
 public StationController(IAuthenticationHelper authenticationHelper, IStationRepository stationRepository, IMapper mapper, LinkGenerator linkGenerator)
 {
     AuthenticationHelper = authenticationHelper;
     StationRepository    = stationRepository;
     Mapper        = mapper;
     LinkGenerator = linkGenerator;
 }
Esempio n. 8
0
 public CheckoutController(ICommandSender commandSender,
                           IQuerySender querySender,
                           IPasswordHasher <string> passwordHasher,
                           IAuthenticationHelper authenticationHelper,
                           ISessionProvider sessionProvider,
                           IConfirmationEmailSender confirmationEmailSender,
                           IClientIpProvider clientIpProvider,
                           ISiteIdProvider siteIdProvider,
                           ISiteUrlsProvider siteUrlsProvider,
                           IGeoCurrency geoCurrency,
                           FIL.Logging.ILogger logger,
                           IMailChimpProvider mailChimpProvider)
 {
     _commandSender           = commandSender;
     _querySender             = querySender;
     _passwordHasher          = passwordHasher;
     _authenticationHelper    = authenticationHelper;
     _sessionProvider         = sessionProvider;
     _confirmationEmailSender = confirmationEmailSender;
     _clientIpProvider        = clientIpProvider;
     _siteIdProvider          = siteIdProvider;
     _siteUrlsProvider        = siteUrlsProvider;
     _logger            = logger;
     _geoCurrency       = geoCurrency;
     _mailChimpProvider = mailChimpProvider;
 }
Esempio n. 9
0
 public ServerListViewModel(IEventAggregator eventAggregator, IAuthenticationHelper authenticationHelper, IWebTasks webTasks)
 {
     _eventAggregator      = eventAggregator ?? throw new ArgumentNullException(nameof(eventAggregator));
     _authenticationHelper = authenticationHelper ?? throw new ArgumentNullException(nameof(authenticationHelper));
     _webTasks             = webTasks ?? throw new ArgumentNullException(nameof(webTasks));
     _serverList           = new ObservableCollection <ServerModel>();
 }
Esempio n. 10
0
 public BusinessController(IBusinessRepository businessRepository, IMapper mapper, LinkGenerator linkGenerator, IAuthenticationHelper authenticationHelper)
 {
     BusinessRepository   = businessRepository;
     Mapper               = mapper;
     LinkGenerator        = linkGenerator;
     AuthenticationHelper = authenticationHelper;
 }
Esempio n. 11
0
 public DataInit(IPetRepository petRepository, IOwnerRepository ownerRepository, IPetTypeRepository petTypeRepository, IAuthenticationHelper authHelper)
 {
     _petRepository       = petRepository;
     _ownerRepository     = ownerRepository;
     _petTypeRepository   = petTypeRepository;
     authenticationHelper = authHelper;
 }
Esempio n. 12
0
 public WorldManagementService(IWorldRepository WorldRepository, IUserRepository userRepository, IAuthenticationHelper authenticationHelper, IWorldPublisher worldPublisher)
 {
     this._worldRepository      = WorldRepository;
     this._userRepository       = userRepository;
     this._authenticationHelper = authenticationHelper;
     this._worldPublisher       = worldPublisher;
 }
Esempio n. 13
0
 public TermEditor(ISqlTermRepository termRepository, IMapper <TermEditModel, Term> termEditMapper, IDbTransaction dbTransaction, ILogRepository logRepository, IAuthenticationHelper authenticationHelper)
 {
     this.termRepository       = termRepository;
     this.termEditMapper       = termEditMapper;
     this.dbTransaction        = dbTransaction;
     this.logRepository        = logRepository;
     this.authenticationHelper = authenticationHelper;
 }
Esempio n. 14
0
 public IndividualController(IIndividualRepository individualRepository, IMapper mapper, LinkGenerator linkGenerator, IAuthenticationHelper authenticationHelper, IStationRepository stationRepository)
 {
     IndividualRepository = individualRepository;
     Mapper               = mapper;
     LinkGenerator        = linkGenerator;
     AuthenticationHelper = authenticationHelper;
     StationRepository    = stationRepository;
 }
 public DbInitializer(
     UnitedMarketsDbContext ctx,
     IRepository <Market> marketRepository,
     IAuthenticationHelper authenticationHelper)
 {
     _ctx = ctx;
     _marketRepository     = marketRepository;
     _authenticationHelper = authenticationHelper;
 }
Esempio n. 16
0
 public ConversationsController(ILogger logger, ICorrelationIdHelper correlationIdHelper, IConfigurationManager configurationManager, IAuthenticationTokenHelper <Guid> authenticationTokenHelper, IQueryFactory queryFactory, IConversationSummaryRepository conversationSummaryRepository, IMessageRepository messageRepository, IAuthenticationHelper authenticationHelper, ICommandPublisher <Guid> commandPublisher)
     : base(logger, correlationIdHelper, configurationManager, authenticationTokenHelper)
 {
     QueryFactory = queryFactory;
     ConversationSummaryRepository = conversationSummaryRepository;
     MessageRepository             = messageRepository;
     AuthenticationHelper          = authenticationHelper;
     CommandPublisher = commandPublisher;
 }
Esempio n. 17
0
 public SessionController(IAuthenticationHelper authenticationHelper,
                          ISessionProvider sessionProvider,
                          IPasswordHasher <string> passwordHasher, IQuerySender querySender)
 {
     _authenticationHelper = authenticationHelper;
     _passwordHasher       = passwordHasher;
     _querySender          = querySender;
     _sessionProvider      = sessionProvider;
 }
Esempio n. 18
0
 public CardEntityKeyGenerator(
     IAuthenticationHelper authenticationHelper,
     IIdentityQueueManager identityQueueManager,
     string rowType)
 {
     this.authenticationHelper = authenticationHelper;
     this.IdentityQueueManager = identityQueueManager;
     this.RowType = rowType;
 }
 public AuthController(
     IUserDataAccess userDataAccess,
     IAuthenticationHelper authenticationHelper,
     IWebCmiConfigProvider webCmiConfigProvider,
     IApplicationRoleUserDataAccess applicationRoleUserDataAccess)
 {
     authControllerHelper = new AuthControllerHelper(applicationRoleUserDataAccess, userDataAccess, ControllerHelper, authenticationHelper,
                                                     webCmiConfigProvider);
 }
Esempio n. 20
0
 public UserHelper(
     IAuthenticationHelper authenticationHelper, 
     IIdentityQueueManager identityQueueManager,
     IQuizCalendar defaultQuizCalendar)
 {
     this.authenticationHelper = authenticationHelper;
     this.identityQueueManager = identityQueueManager;
     this.defaultQuizCalendar = defaultQuizCalendar;
 }
Esempio n. 21
0
 public DataInitializer(IPetRepository petRepository, IOwnerRepository ownerRepository, ITypePetRepository typePetRepository,
                        IUserRepository userRepository, IAuthenticationHelper authenticationHelper)
 {
     _userRepository    = userRepository;
     _petRepository     = petRepository;
     _ownerRepository   = ownerRepository;
     _typePetRepository = typePetRepository;
     _authHelper        = authenticationHelper;
 }
Esempio n. 22
0
 public LoginController(IUserService userService, IConfiguration configuration, IAuthenticationHelper authenticationHelper)
 {
     this._userService          = userService;
     this._authenticationHelper = authenticationHelper;
     this._tokenManager         = new TokenManager(
         configuration["JwtKey"],
         double.Parse(configuration["JwtExpireDays"]),
         configuration["JwtIssuer"]
         );
 }
 public DataInitializer(IPetRepository petRepository, IPetTypeRepository petTypeRepository, IOwnerRepository ownerRepository, IColorRepository colorRepository, IPetColorRepository petColorRepository, IUserRepository userRepository, IAuthenticationHelper authHelper)
 {
     _petRepository       = petRepository;
     _petTypeRepository   = petTypeRepository;
     _ownerRepository     = ownerRepository;
     _colorRepository     = colorRepository;
     _petColorRepository  = petColorRepository;
     _userRepository      = userRepository;
     authenticationHelper = authHelper;
 }
Esempio n. 24
0
        public LoginPage()
        {
            aboutToolbarItem = new ToolbarItem("About", "helpIcon.png", this.About_Click, 0, 0);

            InitializeComponent();
            this.Appearing     += LoginPage_Appearing;
            this.BindingContext = new LoginPageViewModel();

            authHelper = DependencyService.Get <IAuthenticationHelper>();
        }
Esempio n. 25
0
 public QuizResultsController(
     ITableStorageContextFactory tableStorageContextFactory,
     IQuizResultHandler quizResultHandler,
     IAuthenticationHelper authenticationHelper)
 {
     this.quizResultHandler = quizResultHandler;
     this.authenticationHelper = authenticationHelper;
     this.lazyTableStorageContext = new Lazy<ITableStorageContext>(() =>
         tableStorageContextFactory.CreateTableStorageContext(AzureTableNames.CARD, this.authenticationHelper.NameIdentifier));
 }
Esempio n. 26
0
 public TermCreator(
     ISqlTermRepository termRepository,
     IDbTransaction dbTransaction,
     IAuthenticationHelper authenticationHelper,
     ILogRepository logRepository)
 {
     this.termRepository       = termRepository;
     this.dbTransaction        = dbTransaction;
     this.authenticationHelper = authenticationHelper;
     this.logRepository        = logRepository;
 }
Esempio n. 27
0
        /// <inheritdoc />
        public void BeforeTest(ITest test)
        {
            this.log = this.CreateLogger();
            var pageType = GetFixturePage(test);

            var configBuilder  = test.Fixture as IProvideWebDriverConfigBuilder;
            var configHolder   = test.Fixture as IRequireCurrentWebDriverConfig;
            var authentication = test.Fixture as IRequireAuthentication;
            var screenshots    = test.Fixture as IRequireScreenshots;
            var downloads      = test.Fixture as IRequireDownloadDirectory;

            var config =
                configBuilder?.Builder.Build()
                ?? WebDriver
                .Configure(
                    builder =>
            {
                builder.WithDefaultOptions();
                if (downloads != null)
                {
                    builder.DownloadDirectory(downloads.DownloadDirectory);
                }
                return(builder);
            }, log)
                .Build();

            if (configHolder != null)
            {
                configHolder.Config = config;
            }

            /* lazy initialized */
            authHelper = new AuthenticationHelper(config, log);

            var init = authentication != null
        ? (Action <IWebDriverConfig, IWebDriver, IAuthenticationHelper>)AuthenticatedInitialize
        : Initialize;

            ExceptionDispatchInfo initializationException = null;

            (webDriver, initializationException) = WebDriverFactory.CreateAndInitialize(config, (cfg, drv) => init(cfg, drv, authHelper));
            initializationException?.Throw();

            var requiresWebForPageType = RequiresWebType.MakeGenericType(pageType);
            var page = GetPage(pageType, config);

            requiresWebForPageType.GetProperty("StartPage")?.SetValue(test.Fixture, page);

            if (screenshots != null)
            {
                page.WaitForPageToLoad();
                SaveScreenshotForEachTab(TestContext.CurrentContext, "_pre");
            }
        }
Esempio n. 28
0
 public LoginGoogleController(ICommandSender commandSender, IQuerySender querySender, IAuthenticationHelper authenticationHelper, ISessionProvider sessionProvider, ILogger logger,
                              IClientIpProvider clientIpProvider, MailChimp.IMailChimpProvider mailChimpProvider)
 {
     _commandSender        = commandSender;
     _querySender          = querySender;
     _authenticationHelper = authenticationHelper;
     _sessionProvider      = sessionProvider;
     _logger            = logger;
     _clientIpProvider  = clientIpProvider;
     _mailChimpProvider = mailChimpProvider;
 }
Esempio n. 29
0
 public AuthControllerHelper(IApplicationRoleUserDataAccess applicationRoleUserDataAccess,
                             IUserDataAccess userDataAccess,
                             IControllerHelper controllerHelper,
                             IAuthenticationHelper authenticationHelper,
                             IWebCmiConfigProvider webCmiConfigProvider)
 {
     this.applicationRoleUserDataAccess = applicationRoleUserDataAccess;
     this.userDataAccess       = userDataAccess;
     this.controllerHelper     = controllerHelper;
     this.webCmiConfigProvider = webCmiConfigProvider;
     this.authenticationHelper = authenticationHelper;
 }
Esempio n. 30
0
 public OTPLoginController(ICommandSender commandSender, IQuerySender querySender, IPasswordHasher <string> passwordHasher, IAuthenticationHelper authenticationHelper, ISessionProvider sessionProvider, IOTPProvider otpProvider, ILogger logger, ISettings settings, IClientIpProvider clientIpProvider)
 {
     _commandSender        = commandSender;
     _querySender          = querySender;
     _passwordHasher       = passwordHasher;
     _authenticationHelper = authenticationHelper;
     _sessionProvider      = sessionProvider;
     _otpProvider          = otpProvider;
     _logger           = logger;
     _settings         = settings;
     _clientIpProvider = clientIpProvider;
 }
 public AuthenticationMiddleware(
     RequestDelegate next,
     IConfiguration configuration,
     ILogger <AuthenticationMiddleware> logger,
     IAuthenticationHelper authHelper,
     Func <string, ContentfulConfig> createConfig)
 {
     _next          = next;
     _configuration = configuration;
     _logger        = logger;
     _authHelper    = authHelper;
     _createConfig  = createConfig;
 }
Esempio n. 32
0
 public TextReader(
     ISqlTextRepository textRepository,
     IMapper <Text, TextReadModel> textReadMapper,
     IDbTransaction dbTransaction,
     ILogRepository logRepository,
     IAuthenticationHelper authenticationHelper)
 {
     this.textRepository       = textRepository;
     this.textReadMapper       = textReadMapper;
     this.dbTransaction        = dbTransaction;
     this.logRepository        = logRepository;
     this.authenticationHelper = authenticationHelper;
 }
Esempio n. 33
0
 public UserService(
     IRepository <User> userRepository,
     IAuthenticationHelper authenticationHelper,
     IValidator <LoginInputModel> loginInputModelValidator)
 {
     _userRepository = userRepository ??
                       throw new ArgumentNullException(nameof(userRepository),
                                                       "Repository cannot be null.");
     _authenticationHelper = authenticationHelper ??
                             throw new ArgumentNullException(nameof(authenticationHelper),
                                                             "AuthenticationHelper cannot be null.");
     _loginInputModelValidator = loginInputModelValidator ??
                                 throw new ArgumentNullException(nameof(loginInputModelValidator),
                                                                 "LoginInputModelValidator cannot be null.");
 }
Esempio n. 34
0
 public UserService(IUserRepository userRepository,
                    IFoodEntryRepository foodEntryRepository,
                    IMapper mapper,
                    ILogger <IUserService> logger,
                    IAuthenticationHelper authenticationHelper,
                    IJwtHelper jwtHelper,
                    IUserProfileCalculator userProfileCalculator)
 {
     _userRepository      = userRepository;
     _foodEntryRepository = foodEntryRepository;
     _mapper = mapper;
     _logger = logger;
     _authenticationHelper  = authenticationHelper;
     _jwtHelper             = jwtHelper;
     _userProfileCalculator = userProfileCalculator;
 }
Esempio n. 35
0
 public ExportWorkerJob(Int32 agentId, IAgentHelper agentHelper, ISqlQueryHelper sqlQueryHelper, DateTime processedOnDateTime, IEnumerable <Int32> resourceGroupIds, IAPILog logger, IArtifactQueries artifactQueries, APIOptions rsapiApiOptions, IRsapiRepositoryGroup rsapiRepositoryGroup, IAuthenticationHelper authenticationHelper, ISerializationHelper serializationHelper)
 {
     TableRowId            = 0;
     WorkspaceArtifactId   = -1;
     AgentId               = agentId;
     AgentHelper           = agentHelper;
     SqlQueryHelper        = sqlQueryHelper;
     QueueTable            = Constant.Tables.ExportWorkerQueue;
     ProcessedOnDateTime   = processedOnDateTime;
     AgentResourceGroupIds = resourceGroupIds;
     Logger               = logger;
     ArtifactQueries      = artifactQueries;
     RsapiApiOptions      = rsapiApiOptions;
     RsapiRepositoryGroup = rsapiRepositoryGroup;
     AuthenticationHelper = authenticationHelper;
     SerializationHelper  = serializationHelper;
 }
        public AddProjectPageViewModel(IProjectAPI _projectAPI, IAuthenticationHelper _helper, INavigationService _service, ILocationAPI _locationAPI, ISkillAPI _skillAPI, IAttachmentAPI _attachmentAPI)
        {
            projectAPI    = _projectAPI;
            helper        = _helper;
            service       = _service;
            skillAPI      = _skillAPI;
            attachmentAPI = _attachmentAPI;
            locationAPI   = _locationAPI;
            account       = CommonAttributes.account;
            UserName      = account.UserName;

            SignInOutButtonText = account == null ? "Sign In" : "Sign Out";

            //init countries list
            Countries = new ObservableCollection <string>(GetCountryList());

            SignInOutCommand = new RelayCommand(async o =>
            {
                //sign out
                if (account != null)
                {
                    await helper.SignOutAsync(account);
                    account = null;
                    CommonAttributes.account = account;
                    SignInOutButtonText      = "Sign In";
                    service.Navigate(typeof(LogInPage), null);
                }
                else //sign in
                {
                    account = await helper.SignInAsync();
                    if (account != null)
                    {
                        CommonAttributes.account = account;

                        UserName = account.UserName;

                        SignInOutButtonText = "Sign Out";
                    }
                }
            });

            MenuOptions = new HamburgerMenuOptionsFactory(CommonAttributes.account).MenuOptions;
        }
Esempio n. 37
0
 public UserService(IAuthenticationHelper authenticationHelperService)
 {
     _authenticationHelperService = authenticationHelperService;
 }
 private void RESTfulClient_Load(object sender, EventArgs e)
 {
     helper = new FormsAuthenticationHelper();
 }
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == (int)AuthenticationModes.Forms)
                helper = new FormsAuthenticationHelper();

            else
                helper = new ClaimsAuthenticationHelper();
        }
Esempio n. 40
0
 public UIUtils(ICachePersist cachePersist, IAuthenticationHelper authenticationHelper)
 {
     _cachePersist = cachePersist;
     _authenticationHelper = authenticationHelper;
 }
Esempio n. 41
0
 public CardsControllerFake(
     ITableStorageContextFactory tableStorageContextFactory, 
     IAuthenticationHelper authenticationHelper)
     : base(tableStorageContextFactory, authenticationHelper)
 {
 }
 public FederationCallbackController(IAuthenticationHelper authenticationHelper, ITokenStore tokenStore)
 {
     this.authenticationHelper = authenticationHelper;
     this.tokenStore = tokenStore;
 }
 public AccountController()
 {
     _userProfileDbWrapper = new UserProfileDbWrapper();
     _authenticationHelper = new AuthenticationHelper();
 }
 public AccountController(IUserProfileDbWrapper userProfileDbWrapper, IAuthenticationHelper authenticationHelper)
 {
     _userProfileDbWrapper = userProfileDbWrapper;
     _authenticationHelper = authenticationHelper;
 }
 public RESTfulClient()
 {
     InitializeComponent();
     helper = new ClaimsAuthenticationHelper();
 }
Esempio n. 46
0
 public AccountController(IAuthenticationHelper authenticationHelper)
 {
     this.authenticationHelper = authenticationHelper;
 }