/// <summary> /// 在系统中检查用户登录的凭据是否还在 /// </summary> /// <param name="uid"></param> /// <returns></returns> public bool CheckUserIdentity() { //假设服务上有300个用户,没处理一次,需要9秒左右,加上轮询间隔,总共不超过15秒 //执行该方法的总的时间必须 小于每个凭据的过期时间 currentContext.BatchInterval = 5000; currentContext.ParallelExecute = false; System.Diagnostics.Debug.WriteLine("--------------CheckUserIdentity Client IP:{0},{1}", this.currentContext.Request.ClientIP, this.currentContext.Request.ClientIdentity); ServiceAuthentication auth = new ServiceAuthentication(this.currentContext); ServiceIdentity user = auth.GetIdentity(); return(user != null); }
/// <summary> /// 注销登录 /// </summary> /// <returns></returns> public bool Logout() { ServiceAuthentication auth = new ServiceAuthentication(this.currentContext); ServiceIdentity user = auth.GetIdentity(); if (user != null) { UserBIZ biz = new UserBIZ(); biz.SaveLogoutLog(user.Id); return(auth.SignOut(user)); } return(false); }