Ejemplo n.º 1
0
 public AccountController(IDbConnection db, IMetricTracker metrics, ICacheClient cache, IMailController mailController, IUserService userService, IUserAuthenticationService authenticationService)
     : base(db, metrics, cache)
 {
     _mailController = mailController;
     _userService = userService;
     _authenticationService = authenticationService;
 }
 public AuthenticationController(IUserService userService, IUserAuthenticationService service,
                                 IAuditingService audit)
 {
     _service     = service;
     _userService = userService;
     _audit       = audit;
 }
Ejemplo n.º 3
0
 public AccountController(IMappingService mappingService,
                          IUserAuthenticationService userAuthenticationService,
                          IUserService userService) : base(mappingService)
 {
     authenticationService = userAuthenticationService;
     this.userService      = userService;
 }
Ejemplo n.º 4
0
 public AccountDetailPageVM(INavigationService navService, IPageDialogService pageDialogService, IEventAggregator eventAggregator, IUserAuthenticationService userService)
     : base(navService)
 {
     _pageDialogService = pageDialogService;
     _eventAggregator   = eventAggregator;
     _userService       = userService;
 }
Ejemplo n.º 5
0
        public void TryAuthenticate()
        {
            Throw <ArgumentNullException> .If.IsNull(LoginString)?.Now(nameof(LoginString), $"{nameof(LoginString)} cannot be null.");

            Throw <ArgumentNullException> .If.IsNull(Password)?.Now(nameof(Password), $"{nameof(Password)} cannot be null.");

            IUserAuthenticationService service = authServiceFactory.Create(AuthenticationType, new AuthenticationDetails(LoginString, Password));

            Throw <ArgumentNullException> .If.IsNull(service)?.Now(nameof(service), $"{authServiceFactory} produced a null auth service.");

            try
            {
                IAuthToken token = service.TryAuthenticate();

                if (token == null || !token.isValid)
                {
                    OnInvalidAuthToken?.Invoke(token);
                }

                OnValidAuthToken?.Invoke(token);
            }
            catch (ServerLoginException e)
            {
                OnAuthServerError?.Invoke(e.Message);
            }
        }
Ejemplo n.º 6
0
        public LoginCredentialsValidator(IUserAuthenticationService userAuthenticationService)
        {
            _userAuthenticationService = userAuthenticationService;

            RuleFor(x => x.EmailAddress)
            .NotEmpty()
            .WithMessage("Email address is required");

            RuleFor(x => x.Password)
            .NotEmpty()
            .WithMessage("Password is required");

            When(x => !string.IsNullOrEmpty(x.EmailAddress), () => {
                RuleFor(x => x)
                .NotEmpty()
                .MustAsync(AuthenticateEmailAddress)
                .WithMessage("User not found for the given email address");
            });

            When(x => !string.IsNullOrEmpty(x.EmailAddress) && !string.IsNullOrEmpty(x.Password), () => {
                RuleFor(x => x)
                .NotEmpty()
                .MustAsync(AuthenticatePassword)
                .WithMessage("Password is invalid for the given email address");
            });
        }
Ejemplo n.º 7
0
 public EmployeeController(IUserAuthenticationService auth,
                           IEmployeePaymentService empPayService,
                           IListingService listingService) : base(auth)
 {
     EmployeePaymentService = empPayService;
     ListingService         = listingService;
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Functions"/> class.
 /// </summary>
 /// <param name="userAuthenticationService">The user authentication service to use to identify the calling user.</param>
 /// <param name="blobRepository">The blob respository to use for storing audio files.</param>
 public Functions(
     IUserAuthenticationService userAuthenticationService,
     IBlobRepository blobRepository)
 {
     this.UserAuthenticationService = userAuthenticationService;
     this.BlobRepository            = blobRepository;
 }
 public DebugTestJob(IUserContextManager userContextManager,
                     IUserAuthenticationService userAuthenticationService,
                     IUserAuthorizationService userAuthorizationService,
                     IJobExecutionObserver jobExecutionObserver)
     : base(userContextManager, userAuthenticationService, userAuthorizationService, jobExecutionObserver)
 {
 }
Ejemplo n.º 10
0
 public CheckedOutPageVM(INavigationService navigationService, IUserAuthenticationService userService, IEventAggregator aggregator, IWcclsApiService apiService)
     : base(navigationService)
 {
     _userService     = userService;
     _eventAggregator = aggregator;
     _apiService      = apiService;
     _eventAggregator.GetEvent <AccountsChangedEvent>().Subscribe(() => {
         int countOld  = _listUsersCur.Count;
         _listUsersCur = _userService
                         .GetLoggedInUsers()
                         .OrderBy(x => x.Nickname)
                         .ToList();
         //They changed the number of users.
         if (countOld != _listUsersCur.Count)
         {
             //They may have gone from having no users to one or more or visa versa
             RaisePropertyChanged(() => IsUserLoggedIn);
             TaskUtils.FireAndForget(RefreshCheckOuts);
         }
     }, ThreadOption.UIThread);
     _listUsersCur = _userService
                     .GetLoggedInUsers()
                     .OrderBy(x => x.Nickname)
                     .ToList();
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApiFunctions"/> class.
 /// </summary>
 /// <param name="categoriesService">The categories services to use.</param>
 /// <param name="userAuthentication">The user authentication service to use.</param>
 public ApiFunctions(
     ICategoriesService categoriesService,
     IUserAuthenticationService userAuthentication)
 {
     this.CategoriesService         = categoriesService;
     this.UserAuthenticationService = userAuthentication;
 }
Ejemplo n.º 12
0
        private void attachUserToContext(HttpContext context, IUserAuthenticationService userService, string token)
        {
            try
            {
                var tokenHandler = new JwtSecurityTokenHandler();
                var key          = Encoding.ASCII.GetBytes(_appSettings.Jwt.Secret);
                tokenHandler.ValidateToken(token, new TokenValidationParameters
                {
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = new SymmetricSecurityKey(key),
                    ValidateIssuer           = false,
                    ValidateAudience         = false,
                    // set clockskew to zero so tokens expire exactly at token expiration time (instead of 5 minutes later)
                    ClockSkew = TimeSpan.Zero
                }, out SecurityToken validatedToken);

                var jwtToken  = (JwtSecurityToken)validatedToken;
                var userId    = int.Parse(jwtToken.Claims.First(x => x.Type == "userid").Value);
                var userLogin = JsonSerializer.Deserialize <User>(jwtToken.Claims.First(x => x.Type == "userdata").Value);

                // attach user to context on successful jwt validation
                context.Items["UserLogin"] = userLogin;//userService.GetById(userId);
            }
            catch
            {
                // do nothing if jwt validation fails
                // user is not attached to context so request won't have access to secure routes
            }
        }
Ejemplo n.º 13
0
 public AddUserVM(INavigationService navigationService, IWcclsApiService apiService, IPageDialogService pageDialogService, IUserAuthenticationService userService)
     : base(navigationService)
 {
     _apiService        = apiService;
     _pageDialogService = pageDialogService;
     _userService       = userService;
 }
 public DebugTestJob(IUserContextManager userContextManager,
                     IUserAuthenticationService userAuthenticationService,
                     IUserAuthorizationService userAuthorizationService,
                     ITracer tracer)
     : base(userContextManager, userAuthenticationService, userAuthorizationService, tracer)
 {
 }
Ejemplo n.º 15
0
 public Functions(
     IUserAuthenticationService userAuthenticationService,
     IHealthService healthService)
 {
     this.UserAuthenticationService = userAuthenticationService;
     this.HealthService             = healthService;
 }
Ejemplo n.º 16
0
 public AccountController(IUserService userService, IUserAuthenticationService authService, IMailService mailService, IFormsAuthenticationAdapter adapter)
 {
     _userService = userService;
     _authService = authService;
     _mailService = mailService;
     _adapter     = adapter;
 }
Ejemplo n.º 17
0
 public AccountController(
     IUserService userService,
     ILocalizationService <UserResource> localizer, IUserAuthenticationService authenticationService)
 {
     _userService           = userService;
     _localizer             = localizer;
     _authenticationService = authenticationService;
 }
 public AppStartupController(IHubRegistrationService hubRegistrationService,
                             IUserAuthenticationService userAuthenticationService,
                             IOptionsMonitor <Auth0Config> auth0ConfigAccessor)
 {
     _hubRegistrationService    = hubRegistrationService;
     _userAuthenticationService = userAuthenticationService;
     _auth0ConfigAccessor       = auth0ConfigAccessor;
 }
Ejemplo n.º 19
0
 public WebWorkContext(
     IHttpContextAccessor httpContextAccessor,
     IUserAuthenticationService authenticationService)
 {
     this._httpContextAccessor   = httpContextAccessor;
     this._authenticationService = authenticationService;
     GID = Guid.NewGuid();
 }
Ejemplo n.º 20
0
 public AuthenticationController(IMapper mapper,
                                 IUserAuthenticationService authService,
                                 IPasswordRecoveryService passwordRecoveryService)
     : base(mapper)
 {
     _authService             = authService;
     _passwordRecoveryService = passwordRecoveryService;
 }
Ejemplo n.º 21
0
 public Handler(
     IUserAuthenticationService userAuthenticationService,
     IUserRepository repository
     )
 {
     _userAuthenticationService = userAuthenticationService;
     _repository = repository;
 }
        public WopiRequestHandlerFactory(IUserAuthenticationService userAuthenticationService, IUserFileMetadataProvider userFileMetadataProvider, IOptionsSnapshot <Features> features, ILogger <WopiRequestHandlerFactory>?logger = default)
        {
            _userAuthenticationService = userAuthenticationService ?? throw new ArgumentNullException(nameof(userAuthenticationService));
            _userFileMetadataProvider  = userFileMetadataProvider ?? throw new ArgumentNullException(nameof(userFileMetadataProvider));
            _features = features?.Value ?? throw new ArgumentNullException(nameof(features));

            _logger = logger;
        }
Ejemplo n.º 23
0
        public DomainUserService(IUserAuthenticationService domainService)
        {
            if (domainService == null)
            {
                throw new ArgumentNullException(nameof(domainService));
            }

            this.domainService = domainService;
        }
Ejemplo n.º 24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WorkerApiFunctions"/> class.
 /// </summary>
 /// <param name="categoriesService">The categories services to use.</param>
 /// <param name="userAuthentication">The user authentication service to use.</param>
 /// <param name="eventGridSubscriberService">The event grid subcriber service to use.</param>
 public WorkerApiFunctions(
     ICategoriesService categoriesService,
     IUserAuthenticationService userAuthentication,
     IEventGridSubscriberService eventGridSubscriberService)
 {
     this.CategoriesService          = categoriesService;
     this.UserAuthenticationService  = userAuthentication;
     this.EventGridSubscriberService = eventGridSubscriberService;
 }
Ejemplo n.º 25
0
 public UserService(
     IUnitOfWork unitOfWork,
     IUserAuthenticationService userAuthenticationService,
     IUserRepository userRepository)
 {
     this._unitOfWork = unitOfWork;
     this._userAuthenticationService = userAuthenticationService;
     this._userRepository            = userRepository;
 }
Ejemplo n.º 26
0
        public DomainUserService(IUserAuthenticationService domainService)
        {
            if (domainService == null)
            {
                throw new ArgumentNullException(nameof(domainService));
            }

            this.domainService = domainService;
        }
Ejemplo n.º 27
0
 public AuthController(IUserService userService, IUserRegisterationService userRegisterationService, IUserAuthenticationService authService, ICustomerActivityService activityService, ILogService logService, IWorkContext workContext)
 {
     _userService = userService;
     _userRegisterationService = userRegisterationService;
     _authService     = authService;
     _activityService = activityService;
     _logService      = logService;
     _workContext     = workContext;
 }
Ejemplo n.º 28
0
 public UserController(IUserService userService,
                       IMapper mapper,
                       IWorkContext workContext,
                       IUserAuthenticationService userAuthenticationService)
 {
     _userService = userService;
     _mapper      = mapper;
     _workContext = workContext;
     _userAuthenticationService = userAuthenticationService;
 }
Ejemplo n.º 29
0
 public BasicAuthenticationHandler(
     IOptionsMonitor <AuthenticationSchemeOptions> options,
     ILoggerFactory logger,
     UrlEncoder encoder,
     ISystemClock clock,
     IUserAuthenticationService authenticationService
     ) : base(options, logger, encoder, clock)
 {
     this.authenticationService = authenticationService;
 }
Ejemplo n.º 30
0
        public async Task Invoke(HttpContext context, IUserAuthenticationService userService)
        {
            var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();

            if (token != null)
            {
                attachUserToContext(context, userService, token);
            }

            await _next(context);
        }
Ejemplo n.º 31
0
 public AuthenticationController(
     IUserAuthenticationService authenticationService,
     IUserService userService,
     IActivationCodeService activationCodeService,
     IEmailService emailService)
 {
     _authenticationService = authenticationService;
     _userService           = userService;
     _activationCodeService = activationCodeService;
     _emailService          = emailService;
 }
Ejemplo n.º 32
0
 public AccountsPageVM(INavigationService navigationService, IWcclsApiService apiService, IUserAuthenticationService userService, IEventAggregator aggregator)
     : base(navigationService)
 {
     _apiService      = apiService;
     _userService     = userService;
     _eventAggregator = aggregator;
     _eventAggregator
     .GetEvent <AccountsChangedEvent>()
     .Subscribe(() => { LoadUsers(); }, ThreadOption.UIThread);
     LoadUsers();
 }
Ejemplo n.º 33
0
 public AuthenticationController(ISiteMap siteMap, ISession session, IUserAuthenticationService userAuthenticationService)
 {
     _siteMap = siteMap;
     _session = session;
     _userAuthenticationService = userAuthenticationService;
 }
Ejemplo n.º 34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UserInfo"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 public UserInfo(string name)
 {
     Name = name;
     _authenticationService = InversionOfControl.IoC.Resolve<IUserAuthenticationService>();
 }
 /// <summary>
 /// Default Authentication Constructor
 /// </summary>
 public BasicAuthenticationFilter(IUserAuthenticationService authenticationService)
 {
     _authenticationService = authenticationService;
 }
Ejemplo n.º 36
0
 public AccountController(IDocumentSession session, IMetricTracker metrics, IUserAuthenticationService authenticationService)
     : base(session, metrics)
 {
     _authenticationService = authenticationService;
 }
 /// <summary>
 /// AuthenticationFilter constructor with isActive parameter
 /// </summary>
 /// <param name="isActive"></param>
 /// <param name="authenticationService"></param>
 public BasicAuthenticationFilter(bool isActive, IUserAuthenticationService authenticationService)
     : base(isActive)
 {
     _authenticationService = authenticationService;
 }
Ejemplo n.º 38
0
 public AccountController(IUserAuthenticationService uerAuthenticationService, ISessionStateRepository sessionStateRepository)
     : base(sessionStateRepository)
 {
     UserAuthenticationService = uerAuthenticationService;
 }
Ejemplo n.º 39
0
        /// <summary>
        /// Initializes data that might not be available when the constructor is called.
        /// </summary>
        /// <param name="requestContext">The HTTP context and route data.</param>
        protected override void Initialize(RequestContext requestContext)
        {
            if (FormsService == null) {
                FormsService = IoC.Resolve<IFormsAuthenticationService>();
            }
            if (UserAuthenticationService == null)
            {
                UserAuthenticationService = IoC.Resolve<IUserAuthenticationService>();
            }

            base.Initialize(requestContext);
        }