public bool Authorize(HttpContextBase context) { if (!SecurityContext.IsAuthenticated) { try { var cookie = CookiesManager.GetRequestVar(CookiesType.AuthKey).If(x => string.IsNullOrEmpty(x), () => context.Request.Headers["Authorization"]); if (string.IsNullOrEmpty(cookie)) { } if (cookie != null && !string.IsNullOrEmpty(cookie)) { if (!SecurityContext.AuthenticateMe(cookie)) { _log.Warn("ASC cookie auth failed with cookie={0}", cookie); } return(Core.SecurityContext.IsAuthenticated); } _log.Debug("no ASC cookie"); } catch (Exception e) { _log.Error(e, "ASC cookie auth error"); } } return(Core.SecurityContext.IsAuthenticated); }
internal static void TryAuthorize() { if (!SecurityContext.IsAuthenticated) { //Try by cookie var cookiesKey = CookiesManager.GetRequestVar(CookiesType.AuthKey); cookiesKey = System.Web.HttpUtility.UrlDecode(cookiesKey); if (!string.IsNullOrEmpty(cookiesKey)) { SecurityContext.AuthenticateMe(cookiesKey); } } }