/// <summary> /// Get the current user. /// </summary> /// <param name="request">Request.</param> /// <returns>the current user</returns> public object Get(UserGetCurrentRequestTep request) { WebUserTep result; var context = TepWebContext.GetWebContext(PagePrivileges.UserView); try { context.Open(); context.LogInfo(this, string.Format("/user/current GET")); UserTep user = UserTep.FromId(context, context.UserId); try { user.PrivateSanityCheck();//we do it here, because we do not want to do on each Load(), and we are sure users always pass by here }catch (Exception e) { context.LogError(this, e.Message, e); } result = new WebUserTep(context, user, false); try{ var cookie = DBCookie.LoadDBCookie(context, context.GetConfigValue("cookieID-token-access")); result.Token = cookie.Value; TimeSpan span = cookie.Expire.Subtract(DateTime.UtcNow); result.TokenExpire = span.TotalSeconds; }catch (Exception) {} context.Close(); } catch (Exception e) { context.LogError(this, e.Message, e); context.Close(); throw e; } return(result); }