public UserEntity(TokenEntity tokenEntity, IReadAuthRepository readAuthRepository, IOnlineUserMgr onlineUserMgr) { this.UserInfo = tokenEntity.UserInfo; this.readAuthRepository = readAuthRepository; this.onlineUserMgr = onlineUserMgr; this.Option = new UserAuthOption(); this.ClientInfo = tokenEntity.ClientInfo; this.LoginTime = tokenEntity.LoginTime; this.ExpiredTime = tokenEntity.ExpiredTime; this.Token = tokenEntity.Token; }
public OnlineUserMgr(ITokenRepository tokenRepository, IReadAuthRepository readAuthRepository, IRoleAndResDepend roleAndResDepend) { this.tokenRepository = tokenRepository; this.readAuthRepository = readAuthRepository; this.roleAndResDepend = roleAndResDepend; this.Load(); Task.Factory.StartNew(() => { while (true) { this.ClearExpiredPro(); Thread.Sleep(1000 * 60 * 10); } }); }
public UserEntity(int userId, IReadAuthRepository readAuthRepository, RequestClientInfo clientInfo, IOnlineUserMgr onlineUserMgr) { this.readAuthRepository = readAuthRepository; this.onlineUserMgr = onlineUserMgr; this.UserInfo = this.readAuthRepository.GetUserInfo(userId); if (this.UserInfo == null) { this.UserInfo = new UserInfo() { Id = userId }; } this.ClientInfo = clientInfo; this.Option = new UserAuthOption(); this.LoginTime = DateTime.Now; this.ExpiredTime = this.LoginTime.AddSeconds(this.Option.UserLoginExpireIn); //to do generate token string tokenstr = $"token_{UserInfo.Id}_{UserInfo.UserName}_{clientInfo.IP}_{clientInfo.OS}_{this.LoginTime.Ticks}"; this.Token = this.GetMd5(tokenstr); }
public AuthAppService(IOnlineUserMgr onlineUserMgr, IReadAuthRepository readAuthRepository, BAccurateContext context) { this.readAuthRepository = readAuthRepository; this.onlineUserMgr = onlineUserMgr; this.context = context; }