From 92237ce31470361a6a2e7c2ba4326db41417eda2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E9=A1=BA=E6=98=8E?= Date: Sun, 8 Oct 2023 06:47:35 +0800 Subject: [PATCH] change --- Proxy/WebServlet.cs | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/Proxy/WebServlet.cs b/Proxy/WebServlet.cs index ebdd544..e4fa083 100644 --- a/Proxy/WebServlet.cs +++ b/Proxy/WebServlet.cs @@ -384,18 +384,11 @@ namespace UMC.Proxy var transfer = context.QueryString.Get("transfer"); if (context.Token.IsAuthenticated) { - if (String.IsNullOrEmpty(transfer) == false) + if (String.IsNullOrEmpty(transfer) == false && String.Equals(GetCookie(context), transfer) == false) { - if (String.Equals(GetCookie(context), transfer) == false) - { - var sesion = UMC.Data.DataFactory.Instance().Session(context.Token.Device.ToString()); - - if (sesion != null) - { - sesion.SessionKey = transfer; - UMC.Data.DataFactory.Instance().Put(sesion); - } - } + var login = UMC.Data.Reflection.Configuration("account")?["login"]; + var timeout = UMC.Data.Utility.IntParse(login?.Attributes?["timeout"], 3600); + new UMC.Data.AccessToken(Utility.Guid(transfer, true).Value).Login(context.Token.Identity(), timeout).Commit("Desktop", context.UserHostAddress, context.Server); } context.Redirect(oauth_callback); return; @@ -684,11 +677,7 @@ namespace UMC.Proxy var secret = p.Provider["appSecret"]; var appId = p.Provider["appId"]; var type = typeof(UMC.Data.Entities.Session).FullName; - // var nvs = new NameValueCollection(); - // var time = UMC.Data.Utility.TimeSpan().ToString(); - // nvs.Add("from", appId); - // nvs.Add("time", time); - // nvs.Add("type", type); + var webD = new Web.WebMeta(); webD.Put("from", appId); @@ -1291,11 +1280,10 @@ namespace UMC.Proxy var Value = UMC.Data.JSON.Deserialize(seesion.Content); if (Value != null) { - var user = Value.Identity(); - var login = (UMC.Data.Reflection.Configuration("account") ?? new ProviderConfiguration())["login"] ?? Provider.Create("name", "name"); - var timeout = UMC.Data.Utility.IntParse(login.Attributes["timeout"], 3600); - context.Token = new UMC.Data.AccessToken(sessionKey).Login(user, timeout); - context.Token.Commit("Desktop", context.UserHostAddress, context.Server); + var login = UMC.Data.Reflection.Configuration("account")?["login"]; + var timeout = UMC.Data.Utility.IntParse(login?.Attributes?["timeout"], 3600); + new UMC.Data.AccessToken(sessionKey).Login(Value.Identity(), timeout).Commit("Desktop", context.UserHostAddress, context.Server); + } UMC.Data.DataFactory.Instance().Delete(seesion); }