Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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);
         }
     });
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public AuthAppService(IOnlineUserMgr onlineUserMgr, IReadAuthRepository readAuthRepository, BAccurateContext context)
 {
     this.readAuthRepository = readAuthRepository;
     this.onlineUserMgr      = onlineUserMgr;
     this.context            = context;
 }