示例#1
0
 public Account GetAuthenticatedAccount()
 {
     if (HttpContext.Current.Request["Authenticator"] != null && HttpContext.Current.Request["accountID"] != null)
     {
         SSORequest ssoRequest = SSORequest.GetRequest(HttpContext.Current);
         string     actID      = ssoRequest.AccountID;
         if (Authentication.ValidateEACToken(ssoRequest) && !string.IsNullOrEmpty(actID) && We7Helper.IsGUID(actID))
         {
             Security.SetAccountID(actID);
             return(RemoteHelper.GetAccount(actID, null));
         }
         else
         {
             return(null);
         }
     }
     else if (HttpContext.Current.Request["Authenticator"] == null)
     {
         SSORequest req = new SSORequest();
         req.Action = "authenticate";
         req.SiteID = SiteConfigs.GetConfig().SiteID;
         Authentication.CreateAppToken(req);
         Authentication.Post(req, SiteConfigs.GetConfig().PassportAuthPage);
         return(null);
     }
     else
     {
         return(null);
     }
 }
示例#2
0
 public Account GetAccount(string accountID, string[] fields)
 {
     if (accountID == We7Helper.EmptyGUID)
     {
         Account a = new Account();
         a.LoginName = SiteConfigs.GetConfig().AdministratorName;
         a.LastName  = "管理员";
         a.ID        = We7Helper.EmptyGUID;
         return(a);
     }
     else if (accountID == Security.CurrentAccountID)
     {
         if (HttpContext.Current.Session["$We7CurrentAccount"] == null)
         {
             HttpContext.Current.Session["$We7CurrentAccount"] = RemoteHelper.GetAccount(accountID, null);
         }
         return(HttpContext.Current.Session["$We7CurrentAccount"] as Account);
     }
     else
     {
         return(RemoteHelper.GetAccount(accountID, fields));
     }
 }