private void ProcessJWT(HttpContext context) { var request = context.Request; string auth = request.Cookies[JWTUtil.COOKIE_NAME]; if (!string.IsNullOrEmpty(auth)) { try { var info = JWTUtil.DecodeFromJwt(auth); if (JWTUtil.IsValidHost(info, request.Host.Host, request.Host.Port)) { context.User = new ToolkitClaimsPrincipal(info); } } catch (Exception ex) { TkTrace.LogError(ex.Message); } } }
protected void LoadAssembly(Assembly assembly) { TkDebug.AssertArgumentNull(assembly, "assembly", this); Type currentType = null; try { TkTrace.LogInfo($"扫描{assembly.FullName}"); Type[] types = assembly.GetTypes(); Type attrType = typeof(BasePlugInAttribute); foreach (Type type in types) { if (type.IsInterface) { continue; } currentType = type; Attribute[] attrs = Attribute.GetCustomAttributes(type, attrType); if (attrs.Length == 0) { continue; } foreach (BasePlugInAttribute attribute in attrs) { FactoryManager.InternalAddCodePlugIn(this, attribute, type); } } TkTrace.LogInfo($"结束扫描{assembly.FullName}"); } catch (Exception ex) { TkTrace.LogError($"加载{assembly.FullName}出错,错误:{ex.Message}"); HandleStartedExeception("SLoadType", currentType, ex); } }