public AdminController(ILoggerManager logger, IMapper mapper, IUserService userService, IUserLoginService userLoginService)
 {
     _logger           = logger;
     _mapper           = mapper;
     _userService      = userService;
     _userLoginService = userLoginService;
 }
Esempio n. 2
0
 public HomeController(ILogger <HomeController> logger, ISysMenuService sysMenuService, IUserLoginService userLoginService, IUserMenuService userMenuService)
 {
     _logger               = logger;
     this.sysMenuService   = sysMenuService;
     this.userLoginService = userLoginService;
     this.userMenuService  = userMenuService;
 }
Esempio n. 3
0
        public UserLoginResolver(IHttpContextAccessor httpContextAccessor)
        {
            if (httpContextAccessor == null)
            {
                throw new ArgumentNullException(nameof(httpContextAccessor));
            }

            // just to be sure, we are in a tenant context
            var tenantContext = httpContextAccessor.HttpContext.GetTenantContext <IdsvrTenant>();

            if (tenantContext == null)
            {
                throw new ArgumentNullException(nameof(tenantContext));
            }

            if (tenantContext.Tenant.Name == "first")
            {
                _userLoginServiceImplementation = new InMemoryUserLoginService(GetUsersForFirstTenant());
            }
            else if (tenantContext.Tenant.Name == "second")
            {
                _userLoginServiceImplementation = new InMemoryUserLoginService(GetUsersForSecondTenant());
            }
            else
            {
                _userLoginServiceImplementation = new InMemoryUserLoginService(new List <InMemoryUser>());
            }
        }
Esempio n. 4
0
 public UserLoginService(
     IUserLoginService _login,
     IUserService _user)
 {
     this._login = _login;
     this._user  = _user;
 }
Esempio n. 5
0
 public AuthLoginProvider(
     IUserLoginService _login,
     IUserService _user)
 {
     this._login = _login;
     this._user  = _user;
 }
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            IUserLoginService    testLoginService    = new TestLoginService(SignInManager, UserManager);
            IUserLoginService    hogentLoginService  = new HogentLoginService(SignInManager, UserManager);
            ILoginServiceFactory loginServiceFactory = new UserLoginServiceFactory(testLoginService, hogentLoginService);
            IUserLoginService    service             = loginServiceFactory.GetLoginService(model.UserName);
            SignInStatus         result = await service.Login(model.UserName, model.Password, model.RememberMe);

            switch (result)
            {
            case SignInStatus.Success:
                return(RedirectToLocal(returnUrl));

            case SignInStatus.LockedOut:
                return(View("Lockout"));

            case SignInStatus.RequiresVerification:
                return(RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = model.RememberMe }));

            case SignInStatus.Failure:
            default:
                ModelState.AddModelError("", "Het emailadres en/of wachtwoord is onbekend.");
                return(View(model));
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Get Token and Store in Cache
        /// </summary>
        /// <returns></returns>
        private async Task <bool> GetTokenForUser()
        {
            // Crypt password
            var passwordCrypted = Convert.ToBase64String(Utils.EncryptStringToBytes_Aes(Password));

            _url = GetUrlForCompany(UserName);
            _userLoginService = new UserLoginService(new UserModel {
                UserName = UserName, Password = passwordCrypted, URL = _url
            });
            string token = await _userLoginService.GetToken(new UserModel { UserName = UserName, Password = passwordCrypted });

            if (!String.IsNullOrEmpty(token))
            {
                Application.Current.Properties["UserData"] = Utils.SerializeToJson(new UserModel {
                    UserName = UserName, Password = passwordCrypted, Token = token, URL = _url
                });
                return(true);
            }
            else if (token == null)
            {
                await _pageService.DisplayAlert("Erreur de connexion", "Connectez-vous à internet puis réessayez.", "Ok");

                return(false);
            }
            else
            {
                await _pageService.DisplayAlert("Connexion refusée", "Vous n'êtes pas autorisé à vous connecter.\nVérifiez vos identifiants puis réessayer.", "Ok");

                return(false);
            }
        }
Esempio n. 8
0
 public AboutViewModel(IUserLoginService userLoginService)
 {
     Title             = "About";
     _userLoginService = userLoginService ?? throw new System.ArgumentNullException(nameof(userLoginService));
     OpenWebCommand    = new Command(async() => await Browser.OpenAsync("https://www.korpen-sundbyberg.se/varasektioner/Innebandy/innebandy4utanmalvakt/Herrar/Division1/"));
     DeleteUserCommand = new Command(async() => await _userLoginService.DeleteUser(User.Id));
 }
Esempio n. 9
0
        private void attachUserToContext(HttpContext context, IUserLoginService userLoginService, string token)
        {
            try
            {
                var tokenHandler = new JwtSecurityTokenHandler();
                var key          = Encoding.ASCII.GetBytes(_appSettings.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 == "id").Value);

                // attach user to context on successful jwt validation
                context.Items["UserLogin"] = userLoginService.GetById(userId);
            }
            catch
            {
                // do nothing if jwt validation fails
                // user is not attached to context so request won't have access to secure routes
            }
        }
Esempio n. 10
0
 public UserService(IUserLoginService userLoginService, IOptions <AppSettings> appSettings, IEmployeeService employeeService, IRefreshTokenService refreshTokenService, IRevokeTokenService revokeTokenService)
 {
     _userLoginService    = userLoginService;
     _employeeService     = employeeService;
     _refreshTokenService = refreshTokenService;
     _revokeTokenService  = revokeTokenService;
     _appSettings         = appSettings.Value;
 }
 public SimpleAuthorizationServerProvider()
 {
     _appService       = StructureMap.ObjectFactory.GetInstance <IAppService>();
     _companyService   = StructureMap.ObjectFactory.GetInstance <ICompanyService>();
     _userLoginService = StructureMap.ObjectFactory.GetInstance <IUserLoginService>();
     _customerService  = StructureMap.ObjectFactory.GetInstance <IPatientService>();
     _roleService      = StructureMap.ObjectFactory.GetInstance <IRoleService>();
 }
 public AuthenticationController(ITokenService tokenService,
                                 IUserLoginService userLoginService,
                                 IMapper mapper)
 {
     _tokenService     = tokenService;
     _userLoginService = userLoginService;
     _mapper           = mapper;
 }
Esempio n. 13
0
 public MovieController(IMovieService _movieService, ICountryMovieService _countryMovieService, IMapper _mapper, IUserLoginService _userLoginService, ICommentService _commentService)
 {
     moviesService       = _movieService;
     countryMovieService = _countryMovieService;
     mapper           = _mapper;
     userLoginService = _userLoginService;
     commentService   = _commentService;
 }
Esempio n. 14
0
 public AccountController(
     IAuthApi _authApi,
     IUserLoginService _login,
     ICacheProvider _cache)
 {
     this._login   = _login;
     this._authApi = _authApi;
     this._cache   = _cache;
 }
 public AuthenticationController(IRegisterUserService registerUserService, IUserLoginService userLoginService,
                                 UserManager <User> userManager, SignInManager <User> signInManager)
 {
     _registerUserService = registerUserService;
     _userLoginService    = userLoginService;
     _emailService        = new EmailService();
     _userManager         = userManager;
     _signInManager       = signInManager;
 }
 public LoginController(
     IUserLoginService userLoginService,
     [FromServices] SigningConfigurations signingConfigurations,
     [FromServices] TokenConfigurations tokenConfigurations)
 {
     _userLoginService      = userLoginService;
     _signingConfigurations = signingConfigurations;
     _tokenConfigurations   = tokenConfigurations;
 }
Esempio n. 17
0
 public AccountController(
     IUserLoginService loginService,
     IIdentityServerInteractionService interaction,
     IClientStore clientStore)
 {
     _loginService = loginService;
     _interaction  = interaction;
     _clientStore  = clientStore;
 }
Esempio n. 18
0
 public AccountController()
 {
     _userService           = StructureMap.ObjectFactory.GetInstance <IUserService>();
     _roleService           = StructureMap.ObjectFactory.GetInstance <IRoleService>();
     _rolePermissionService = StructureMap.ObjectFactory.GetInstance <IRolePermissionService>();
     _userLoginService      = StructureMap.ObjectFactory.GetInstance <IUserLoginService>();
     _systemSettingervice   = StructureMap.ObjectFactory.GetInstance <ISystemSettingService>();
     _companyService        = StructureMap.ObjectFactory.GetInstance <ICompanyService>();
 }
Esempio n. 19
0
 public LoginController(ILoginAuthenticationModelValidator loginAuthenticationModelValidator, IUserLoginService userLoginService, IDependencyProvider dependencyProvider, ISettings settings, ISessionContext sessionContext, IUserLogService userLogService)
 {
     _loginAuthenticationModelValidator = loginAuthenticationModelValidator;
     _userLoginService   = userLoginService;
     _dependencyProvider = dependencyProvider;
     _sessionContext     = sessionContext;
     _userLogService     = userLogService;
     _settings           = settings;
 }
Esempio n. 20
0
 public ItemDetailViewModel(IDataStore <Event> dataStore, IUserLoginService userLoginService)
 {
     _dataStore           = dataStore;
     _userLoginService    = userLoginService;
     AttendCommand        = new Command(OnAttend);
     EditItemCommand      = new Command(OnEditItemTapped, CanEditItem);
     DeleteCommand        = new Command(OnDelete, CanEditItem);
     AddressTappedCommand = new Command(async() => await OnAddressTapped());
 }
 public AuctionProcessFacade(IUnitOfWorkProvider unitOfWorkProvider, IAuctionService auctionService,
                             IClosingAuctionService closingAuctionService, IBidService bidService, ICategoryService categoryService, IUserLoginService userLoginService)
     : base(unitOfWorkProvider)
 {
     _auctionService        = auctionService;
     _closingAuctionService = closingAuctionService;
     _bidService            = bidService;
     _categoryService       = categoryService;
     _userLoginService      = userLoginService;
 }
Esempio n. 22
0
 public Login(User user)
 {
     InitializeComponent();
     this.user        = user;
     userLoginService = new DuplexChannelFactory <IUserLoginService>(
         new InstanceContext(this),
         new WSDualHttpBinding(),
         "http://localhost:8080/ILoginService"
         ).CreateChannel();
     loginButton.Click += LoginButton_Click;
 }
Esempio n. 23
0
 public Login()
 {
     InitializeComponent();
     userLoginService = ChannelBuilder.GetChannelFactory <IUserLoginService>(
         new InstanceContext(this),
         new WSDualHttpBinding(),
         "http://localhost:8080/ILoginService"
         ).CreateChannel();
     loginButton.Click        += LoginButton_Click;
     registrationButton.Click += RegistrationButton_Click;
 }
Esempio n. 24
0
        public async Task Invoke(HttpContext context, IUserLoginService userLoginService)
        {
            var token = context.Request.Headers["Authorization"].FirstOrDefault()?.Split(" ").Last();

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

            await _next(context);
        }
Esempio n. 25
0
        public UserLoginServiceTests()
        {
            var dbContext = new DatingAppDbContext(_options);

            dbContext.Users.RemoveRange(dbContext.Users);
            dbContext.SaveChanges();

            _userLoginService = new UserLoginService(dbContext,
                                                     _tokenServiceMock.Object,
                                                     _passwordValidatorMock.Object);
        }
Esempio n. 26
0
 public ServerGameStateService(
     IUserLoginService loginService,
     IUserDataRoleService roleService,
     TWorld gameStateDataLayer,
     ISerializationAdapter serializationAdapter)
 {
     LoginService            = loginService ?? throw new ArgumentNullException(nameof(loginService));
     RoleService             = roleService ?? throw new ArgumentNullException(nameof(roleService));
     WorldGameStateDataLayer = gameStateDataLayer ?? throw new ArgumentNullException(nameof(gameStateDataLayer));
     SerializationAdapter    = serializationAdapter ?? throw new ArgumentNullException(nameof(serializationAdapter));
     LoadDefaultGameStates();
 }
Esempio n. 27
0
        public NewItemViewModel(IDataStore <Event> dataStore, IDataStore <User> userDataStore, IUserLoginService userLoginService)
        {
            SaveCommand      = new Command(OnSave, ValidateSave);
            CancelCommand    = new Command(OnCancel);
            PropertyChanged += (_, __) => SaveCommand.ChangeCanExecute();

            Date              = DateTime.Now;
            _eventDataStore   = dataStore;
            _userDataStore    = userDataStore;
            _userLoginService = userLoginService;
            PopulateEventTypes();
        }
Esempio n. 28
0
        public ItemsViewModel(IEventDataStore dataStore, IUserLoginService userLoginService)
        {
            Title            = "Aktiviteter";
            Items            = new ObservableCollection <Event>();
            LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand());

            ItemTapped = new Command <Event>(OnItemSelected);

            AddItemCommand    = new Command(OnAddItem);
            _dataStore        = dataStore;
            _userLoginService = userLoginService;
        }
Esempio n. 29
0
 public AuthController(
     ISignInService signInService,
     IUserService userService,
     IMapper mapper,
     IUserLoginService userLoginService,
     IRoleService roleService)
 {
     _signInService        = signInService;
     _userService          = userService;
     _mapper               = mapper;
     this.roleService      = roleService;
     this.userLoginService = userLoginService;
 }
Esempio n. 30
0
 public UserService(
     IRepository <UserData> userDataRepository,
     IRepository <Role> roleRepository,
     IHashCryptoHelper hashCryptoHelper,
     IUserServiceValidationHelper userServiceValidationHelper,
     IUserLoginService userLoginService)
 {
     this.userDataRepository          = userDataRepository;
     this.roleRepository              = roleRepository;
     this.hashCryptoHelper            = hashCryptoHelper;
     this.userServiceValidationHelper = userServiceValidationHelper;
     this.userLoginService            = userLoginService;
 }
Esempio n. 31
0
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public AuthController(IUnitOfWorkFactory<BrewgrContext> unitOfWorkFactory, IUserLoginService userLoginService, 
			IAuthenticationService authService, IUserResolver userResolver, IOAuthService oAuthService, IUserService userService,
			IFacebookConnectSettings facebookConnectSettings, IEmailSender emailSender,
			IEmailMessageFactory emailMessageFactory)
		{
			this.UnitOfWorkFactory = unitOfWorkFactory;
			this.UserLoginService = userLoginService;
			this.AuthenticationService = authService;
			this.UserResolver = userResolver;
			this.OAuthService = oAuthService;
			this.UserService = userService;
			this.FacebookConnectSettings = facebookConnectSettings;
			this.EmailSender = emailSender;
			this.EmailMessageFactory = emailMessageFactory;
		}
Esempio n. 32
0
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public RootController(IUnitOfWorkFactory<BrewgrContext> unitOfWorkFactory, IUserLoginService userLoginService, 
			IAuthenticationService authService, IUserResolver userResolver, IOAuthService oAuthService, IUserService userService,
			ISearchService searchService, IFacebookConnectSettings facebookConnectSettings, IMarketingService marketingService,
			IRecipeService recipeService, IEmailMessageFactory emailMessageFactory, IEmailSender emailSender, ISeoSitemap seoSitemap)
		{
			this.UnitOfWorkFactory = unitOfWorkFactory;
			this.UserLoginService = userLoginService;
			this.AuthService = authService;
			this.UserResolver = userResolver;
			this.OAuthService = oAuthService;
			this.UserService = userService;
			this.SearchService = searchService;
			this.FacebookConnectSettings = facebookConnectSettings;
			this.MarketingService = marketingService;
			this.RecipeService = recipeService;
			this.EmailMessageFactory = emailMessageFactory;
			this.EmailSender = emailSender;
			this.SeoSitemap = seoSitemap;
		}
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public DefaultUserResolver(IUserService userService, IUserLoginService userLoginService, IUnitOfWorkFactory<BrewgrContext> unitOfWorkFactory)
		{
			this.UserLoginService = userLoginService;
			this.UnitOfWorkFactory = unitOfWorkFactory;
		}