using Entity; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; namespace EasyBL.WEBAPP { public static class SETokenUtil { public static SEToken GetToken(HttpRequestMessage message) { SEToken seToken = new SEToken(); IEnumerable headerValues; if (message.Headers.TryGetValues("authtoken", out headerValues)) { var token = headerValues.FirstOrDefault(); seToken = Decrypt(token); } return seToken; } public static SEToken Decrypt(string data) { SEToken seToken = new SEToken(); if (!string.IsNullOrEmpty(data)) { var authtoken = EasyNet.SecurityUtil.Decrypt(data); var saAuthtoken = authtoken.Split(','); seToken.OrgID = saAuthtoken[0].Split(':')[1]; seToken.Email = saAuthtoken[1].Split(':')[1]; seToken.MemberID = saAuthtoken[1].Split(':')[1]; seToken.SignToken = saAuthtoken[2].Split(':')[1]; } return seToken; } } }