/// <summary> /// POS登出 /// </summary> public void Delete() { var user = (StoreUserPrincipal)Thread.CurrentPrincipal; IStoreUserService storeUserService = AutofacBootstapper.CurrentContainer.ResolveOptional <IStoreUserService>( new NamedParameter("token", user.UserCredentials.Token) ); storeUserService.Logout(); }
public StoreUsersController( UserManager <StoreUser> userManager, IStoreUserService storeUserService, IDatabaseService databaseService, IManageService manageService, IViewModelMapper <StoreUser, StoreUserViewModel> storeUserMapper, IViewModelMapper <List <StoreUser>, StoreUsersCollectionViewModel> storeUsersCollectionMapper) { this.userManager = userManager; this.storeUserService = storeUserService; this.databaseService = databaseService; this.manageService = manageService; this.storeUserMapper = storeUserMapper; this.storeUsersCollectionMapper = storeUsersCollectionMapper; }
public UserCredentials Post([FromBody] LoginAction loginAction) { IStoreUserService storeUserService = AutofacBootstapper.CurrentContainer.ResolveOptional <IStoreUserService>( new NamedParameter("companyId", loginAction.CompanyId), new NamedParameter("storeId", loginAction.StoreId), new NamedParameter("machineSn", loginAction.MachineSn), new NamedParameter("deviceSn", loginAction.DeviceSn) ); var result = storeUserService.Login(loginAction.Account, loginAction.Password, loginAction.Practice); var principal = new StoreUserPrincipal(result); Thread.CurrentPrincipal = principal; if (HttpContext.Current != null) { HttpContext.Current.User = principal; } return(result); }
public ClientsController( IClientService clientService, IAddressService addressService, ICityService cityService, ICountryService countryService, IStoreUserService storeUserService, IViewModelMapper <Client, ClientInfoViewModel> clientInfoMapper, IViewModelMapper <Client, ClientCUViewModel> clientCUMapper, IDatabaseService databaseService ) { this.clientService = clientService ?? throw new ArgumentNullException(nameof(clientService)); this.addressService = addressService ?? throw new ArgumentNullException(nameof(addressService)); this.cityService = cityService ?? throw new ArgumentNullException(nameof(cityService)); this.countryService = countryService ?? throw new ArgumentNullException(nameof(countryService)); this.storeUserService = storeUserService ?? throw new ArgumentNullException(nameof(storeUserService)); this.databaseService = databaseService; this.clientInfoMapper = clientInfoMapper ?? throw new ArgumentNullException(nameof(clientInfoMapper)); this.clientCUMapper = clientCUMapper ?? throw new ArgumentNullException(nameof(clientCUMapper)); }
private bool ValidateTicket(string strTicket) { IStoreUserService storeUserService = AutofacBootstapper.CurrentContainer.ResolveOptional <IStoreUserService>( new NamedParameter("token", strTicket) ); var user = storeUserService.GetLoginCredentials(); if (user == null) { return(false); } var principal = new StoreUserPrincipal(user); Thread.CurrentPrincipal = principal; if (HttpContext.Current != null) { HttpContext.Current.User = principal; } return(true); }
public AccountController(ILogger <AccountController> logger, IStoreUserService userService, IToken token) { _logger = logger; _userService = userService; _token = token; }
public StoreUserController(IStoreUserService userService, IDistributedCache distributedCache) { _userService = userService; _distributedCache = distributedCache; }