public void Configure(IApplicationBuilder app, IHostingEnvironment env, AppDbContext context, IAuthenticateService userService) { app.UseAuthentication(); context.Database.EnsureCreated(); userService.Create(new User { Email = _settings.AdminLogin, Role = UserRole.Administrator }, _settings.AdminPassword); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseCors(x => x .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader() .AllowCredentials()); app.UseMvc(rb => { rb.MapRoute( name: "default", template: "{controller}/{action}/{id?}" ); //defaults: new {controller = "Home", action = "Index"}); }); }
public LoginController(IConfiguration configuration, SignInManager <IdentityUser> signInManager, IAuthenticateService authenticationJWTService) { _configuration = configuration; _signInManager = signInManager; _authenticationJWTService = authenticationJWTService; }
public AuthentificationController(IAuthenticateService authenticateService, IMapper mapper, ILogsService log, IHttpContextAccessor httpContextAccessor) { _authenticateService = authenticateService; _mapper = mapper; _log = log; _httpContextAccessor = httpContextAccessor; }
public UsersController( IRegisterService registerService, IAuthenticateService authenticateService) { _registerService = registerService; _authenticateService = authenticateService; }
public authenticationController(IAuthenticateService authService, IInstituteRepository instituteRepository, IMapper mapper) { this._authService = authService; this._instituteRepository = instituteRepository ?? throw new ArgumentNullException(nameof(instituteRepository)); _mapper = mapper ?? throw new ArgumentNullException(nameof(mapper)); }
private static bool AuthenticateUser(ControllerContext context, IAuthenticateService authenticateService) { if (context.HttpContext.User.Identity.IsAuthenticated) { var userId = context.HttpContext.User.Identity.Name; if (!string.IsNullOrWhiteSpace(userId)) { var sessionSecurityToken = context.HttpContext.Cache[string.Concat(CacheKeyNames.Identity, userId)] as SessionSecurityToken; if (sessionSecurityToken != null) { // If the user's claims principal was located in cache retrieve it from there. context.HttpContext.User = sessionSecurityToken.ClaimsPrincipal; return true; } if (authenticateService.ValidateUser(Int32.Parse(userId))) { // If the user's claims principal was not located in cache set it and repeat the login steps. Login(context.HttpContext, true); return true; } } } return false; }
public AccountController(IAuthenticateService authService, UserManager <ApplicationUser> userManager, IApplicationUserService applicationUserService) { _authenticateService = authService; _userManager = userManager; _applicationUserService = applicationUserService; }
public AccountController( IAuthenticateService auth, IUserService userService) { this.auth = auth; this.userService = userService; }
public ResourceController(IResourceService service, IUserManagementService userManager, IAuthenticateService authenticateService) { _service = service; _userManager = userManager; _authenticateService = authenticateService; }
public UsersController(IUserBalancesService balances, IAuthenticateService authenticateService, ITransactionsService transactions, IUsersService users) { _authenticateService = authenticateService; _balances = balances; _transactions = transactions; _users = users; }
public ProjectTypeController(IProjectTypeService service, IUserManagementService userManager, IAuthenticateService authenticateService) { _service = service; _userManager = userManager; _authenticateService = authenticateService; }
public UsersController( IAuthenticateService authenticateService, IRefreshTokenService refreshTokenService) { this.authenticateService = authenticateService; this.refreshTokenService = refreshTokenService; }
public UserService(IUserRepository userRepository, IAuthenticateService authenticateService, ILoginRepository loginRepository, IPasswordHashService passwordHashService) { _userRepository = userRepository; _authenticateService = authenticateService; _loginRepository = loginRepository; _passwordHashService = passwordHashService; }
public ProjectController(IProjectService projectService, IUserManagementService userManager, IAuthenticateService authenticateService) { _projectService = projectService; _userManager = userManager; _authenticateService = authenticateService; }
public ValuesController(TestApiAppContext context, IAuthenticateService authService, IOptions <TokenManagement> tokenManagement) { _context = context; // _requestLogin = login; _authService = authService; _tokenManagement = tokenManagement.Value; }
public AuthController(IUserService userService, IRoleService roleService, IConfiguration config, IAuthenticateService authService) { _userService = userService; _roleService = roleService; _authService = authService; _config = config; }
public AuthenticateController( IAuthenticateService accountService, IMapper mapper) { _accountService = accountService; _mapper = mapper; }
public AuthenticateController(IUserService serviceUser, IAuthenticateService serviceAuth , IConfiguration config, IAuthenticateWrapper authenticateWrapper) { _authenticateWrapper = authenticateWrapper; _serviceAuth = serviceAuth; _authOptions = config.GetSection("AuthOptions").Get <AuthOptions>(); }
public ApplicationUserService(IMapper mapper, UserManager <ApplicationUser> userManager, IAuthenticateService authenticateService) //: base(mapper) { _userManager = userManager; _mapper = mapper; _authenticateService = authenticateService; }
public AccountController ( IAuthenticateService authenticateService ) { _authenticateService = authenticateService; }
public override void SetRepositories() { _MasterRepo.NetworkInterface = (U, P, A) => ExecuteQueryWithObjectAndNetworkAccessAsync(U, P, A); _MasterRepo.NetworkInterfaceWithTypedParameters = (U, P, A) => ExecuteQueryWithTypedParametersAndNetworkAccessAsync(U, P, A); _AuthService = new AuthenticateService(_MasterRepo.NetworkInterface); _Reposetory = new LoginRepository(_MasterRepo, _AuthService); }
public AuthenticateController( IAuthenticateService authServ, IUserManagementService userManagementServ) { authService = authServ; userManagementService = userManagementServ; }
public UserContext(HttpContextBase httpContext, ICustomerService customerService, IAuthenticateService authenticateService) { _httpContext = httpContext; _customerService = customerService; _authenticateService = authenticateService; }
public AuthController( IAuthenticateService authenticateService, IUserContextDataProvider userContextDataProvider) : base(userContextDataProvider) { this.authenticateService = authenticateService; }
public DonationController(IDonationService donationService, ILiqPayService liqPayService, IAuthenticateService authenticateService) { _donationService = donationService; _liqPayService = liqPayService; _authenticateService = authenticateService; }
public AuthCommandHandler(IAuthenticateService service, IUserRepository repository, IPasswordHasher hasher) { _service = service; _repository = repository; _hasher = hasher; }
public void GetAuthTokenSuccessTest() { // Arrange AuthenticateUserResource resource = new AuthenticateUserResource(); User user = new User(); mapper.Map <AuthenticateUserResource, User>(Arg.Any <AuthenticateUserResource>()).Returns(user); IAuthenticateService authenticateService = Substitute.For <IAuthenticateService>(); string token; authenticateService.IsAuthenticated(user, out token) .Returns(x => { x[1] = "token"; return(true); }); AuthenticateController controller = new AuthenticateController(authenticateService, mapper); // Act IActionResult result = controller.GetAuthToken(resource); // Assert result.Should().BeOfType <OkObjectResult>(); OkObjectResult okResult = result as OkObjectResult; okResult.Value.Should().Be("token"); }
public WebWorkContext( IAuthenticateService authenticationService, IHttpContextAccessor httpContextAccessor) { _authenticationService = authenticationService; _httpContextAccessor = httpContextAccessor; }
public GoogleAuthenticateService(IAuthenticateService tokenAuthenticationService, UserManager <ApplicationUser> userManager, IAuthenticateService authenticateService, SignInManager <ApplicationUser> signInManager) { _tokenAuthenticationService = tokenAuthenticationService; _userManager = userManager; _authenticateService = authenticateService; _signInManager = signInManager; }
public LoginViewViewModel(IViewAwareStatus viewAwareStatus, IAuthenticateService authenticateService, IMessageBoxService messageBoxService, IBusinessUnitService businessUnitService, IViewInjectionService viewInjectionService) { //base.IsCloseable = true; //Initialise Services this.viewAwareStatus = viewAwareStatus; this.authenticateService = authenticateService; this.messageBoxService = messageBoxService; this.businessUnitService = businessUnitService; this.viewInjectionService = viewInjectionService; //this.regionManager = regionManager; //Initialise Properties UserName = new DataWrapper <string>(this, userNameArgs); Password = new DataWrapper <string>(this, passwordArgs); SelectedBusinessUnit = new DataWrapper <Int32>(this, businessUnitsArgs); this.viewAwareStatus.ViewLoaded += new Action(viewAwareStatus_ViewLoaded); cachedListOfDataWrappers = DataWrapperHelper.GetWrapperProperties <LoginViewViewModel>(this); //Register Mediator Mediator.Instance.Register(this); //Initialise Rules userName.AddRule(UserNameCannnotBeEmptyRule); password.AddRule(PasswordCannotBeEmptyRule); selectedBusinessUnit.AddRule(SelectedBusinessUnitCannotBeEmpty); //Initialise Commands LoginCommand = new SimpleCommand <object, object>(CanExecuteLoginCommand, ExecuteLoginCommand); CancelLoginCommand = new SimpleCommand <object, object>(ExecuteCancelLoginCommand); }
/// <summary> /// 构造一个权限认证Session,需要提供一个认证服务对象 /// </summary> static SecuritySession() { IAuthenticateService authenticateService = SecurityServiceProvider.GetAuthenticateService(); _authenticateService = authenticateService; IAuthorizationService azService = SecurityServiceProvider.GetAuthorizationService(); _azService = azService; }
/// <summary> /// Initializes a new instance of the <see cref="AuthController"/> class. /// </summary> /// <param name="authenticateService">Service for Authentication.</param> /// <param name="context"> Instance of Database context.</param> /// <param name="configuration">Instance of IConfiguration.</param> /// <param name="logger">Logger instance.</param> /// <param name="userService">userservices.</param> /// <param name="userManager">usermanager is a class provided by Identity Library which has bunch of in built methods.</param> public AuthController(IAuthenticateService authenticateService, ILogger <AuthController> logger, DataContext context, IConfiguration configuration, UserManager <User> userManager) { this.authenticateService = authenticateService; this.context = context; this.configuration = configuration; this.logger = logger; this.userManager = userManager; }
public JwtCustomAuthHandler(IOptionsMonitor <BasicAuthenticationOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IAuthenticateService service, IConfiguration config) : base(options, logger, encoder, clock) { this.service = service; this._config = config; }
public HomeController( IAuthenticateService authenticateService, IContactUsService contactUsService, IUserLogService userLogService) { _authenticateService = authenticateService; _contactUsService = contactUsService; _userLogService = userLogService; }
/// <summary> /// 获取用户验证服务对象 /// </summary> /// <returns></returns> public static IAuthenticateService GetAuthenticateService() { Initialize(); if (_atSvc == null) { _atSvc = System.Activator.CreateInstance(Type.GetType(_authenticateServiceProviderType),_config) as IAuthenticateService; } return _atSvc; }
public AuthorizationController(IAuthenticateService authService) { _authService = authService; }
public AccountController(IAuthenticateService authService) { _authService = authService; }
public LoginViewViewModel(IViewAwareStatus viewAwareStatus, IAuthenticateService authenticateService, IMessageBoxService messageBoxService, IBusinessUnitService businessUnitService, IViewInjectionService viewInjectionService) { //base.IsCloseable = true; //Initialise Services this.viewAwareStatus = viewAwareStatus; this.authenticateService = authenticateService; this.messageBoxService = messageBoxService; this.businessUnitService = businessUnitService; this.viewInjectionService = viewInjectionService; //this.regionManager = regionManager; //Initialise Properties UserName = new DataWrapper<string>(this, userNameArgs); Password = new DataWrapper<string>(this, passwordArgs); SelectedBusinessUnit = new DataWrapper<Int32>(this, businessUnitsArgs); this.viewAwareStatus.ViewLoaded += new Action(viewAwareStatus_ViewLoaded); cachedListOfDataWrappers = DataWrapperHelper.GetWrapperProperties<LoginViewViewModel>(this); //Register Mediator Mediator.Instance.Register(this); //Initialise Rules userName.AddRule(UserNameCannnotBeEmptyRule); password.AddRule(PasswordCannotBeEmptyRule); selectedBusinessUnit.AddRule(SelectedBusinessUnitCannotBeEmpty); //Initialise Commands LoginCommand = new SimpleCommand<object, object>(CanExecuteLoginCommand, ExecuteLoginCommand); CancelLoginCommand = new SimpleCommand<object, object>(ExecuteCancelLoginCommand); }