public TBody GetBody() { // 获取 密钥 string secret = SecretBuilder.Build(); if (string.IsNullOrWhiteSpace(secret)) { throw new Exception("应用程序密钥(AppSecret)为空或null"); } ICookieFactory cookieFactory = new CookieFactory(); ICookieClient cookieClient = cookieFactory.Create(); if (!cookieClient.Contains(AuthConfigProvider.AuthConfig.CookieName)) { return(null); } string token = cookieClient.GetCookie(AuthConfigProvider.AuthConfig.CookieName, value => { ICryptor cryptor = new DesCryptor(SecretBuilder.AppKey, secret); return(cryptor.Decrypt(value)); }); TBody authUser = token.DeserializeObject <TBody>(); DateTime expires = authUser.exp.AsDateTime(); if (expires < DateTime.Now) { return(null); // 已失效 } SignIn(authUser); return(authUser); }