protected string GetUserInfo() { var key = HttpContext.GetToken(WebConfiguration.Instance.ConfigSecurityTokenName); if (string.IsNullOrEmpty(key)) { return(string.Empty); } IUserSnap user = Reception.Instance.GetUser(key, LoginType.Web); //IUserInfo user = WinWebGlobalManager.Reception.GetUserInfo(key); if (user == null) { user = GetService <IProfile>().GetUserSnap(key, LoginType.Web); } if (user == null) { return(string.Empty); } //WinWebGlobalManager.Reception.Sign(HttpContext, user); string _u = user.ToXml(); return(_u); }
public SessionSnap(IUserSnap user) { UserSnap = user; LastTime = DateTime.Now; //SecurityToken = user.SecurityKey; _securityToken = string.Format("{0}{1}{2}", user.Id, user.Account, user.LoginCode).ToMD5(); }
public T GetService <T>(IUserSnap me) where T : ITripBusiness { var ibusiness = AutofacResolver.Instance.GetService <T>(); ibusiness.SetUserSnap(me); return(ibusiness); }
public void SetUserSnap(IUserSnap snap) { if (_me == null || _me.Account != snap.Account) { _me = snap; } }
public bool IsAuthorized(IUserSnap user) { IUserSnap snap = GetUser(user.SecurityKey, user.LoginType); if (snap == null) { return(false); } return(_session_manager.IsValid(user)); }
public string Add(IUserSnap snap) { Refresh(); ISessionSnap session = _session_snaps.SingleOrDefault(s => s.UserSnap.SecurityKey == snap.SecurityKey); if (session == null) { session = new SessionSnap(snap); _session_snaps.Add(session); } return session.SecurityToken; }
public string Add(IUserSnap snap) { Refresh(); ISessionSnap session = _session_snaps.SingleOrDefault(s => s.UserSnap.SecurityKey == snap.SecurityKey); if (session == null) { session = new SessionSnap(snap); _session_snaps.Add(session); } return(session.SecurityToken); }
public IUserSnap GetUser(string securitytoken, LoginType type) { IUserSnap snap = _session_manager.Get(securitytoken); if (snap == null) { _usersnap_loader.SetResource(WebConfiguration.Instance.WebUpdateUserAddress); snap = _usersnap_loader.Load(securitytoken, type); if (snap == null) { return(snap); } _session_manager.Add(snap); } return(snap); }
public bool IsValidUser(IUserSnap snap) { return _securityToken.Equals(string.Format("{0}{1}{2}", snap.Id, snap.Account, snap.LoginCode).ToMD5()); }
public bool IsAuthorized(IUserSnap user) { IUserSnap snap = GetUser(user.SecurityKey, user.LoginType); if (snap == null) return false; return _session_manager.IsValid(user); }
public void SaveCookies(HttpContextBase context, IUserSnap user) { context.SaveCookie(WebConfiguration.Instance.ConfigAccountTokenName, user.Account, WebConfiguration.Instance.ConfigDomainName); context.SaveCookie(WebConfiguration.Instance.ConfigIdTokenName, user.Id, WebConfiguration.Instance.ConfigDomainName); context.SaveCookie(WebConfiguration.Instance.ConfigSecurityTokenName, user.SecurityKey, WebConfiguration.Instance.ConfigDomainName); }
public bool IsValid(IUserSnap snap) { ISessionSnap session = _session_snaps.SingleOrDefault(s => s.UserSnap.SecurityKey == snap.SecurityKey); return session.IsValidUser(snap); }
public bool IsValidUser(IUserSnap snap) { return(_securityToken.Equals(string.Format("{0}{1}{2}", snap.Id, snap.Account, snap.LoginCode).ToMD5())); }
public bool IsValid(IUserSnap snap) { ISessionSnap session = _session_snaps.SingleOrDefault(s => s.UserSnap.SecurityKey == snap.SecurityKey); return(session.IsValidUser(snap)); }