public static bool AuthenticateTicket() {
			// see http://issues.umbraco.org/issue/U4-6342#comment=67-19466 (from http://issues.umbraco.org/issue/U4-6332)
			var http = new HttpContextWrapper(HttpContext.Current);
			var ticket = http.GetUmbracoAuthTicket();
			if (ticket != null)
			{
				return http.AuthenticateCurrentRequest(ticket, true);
			}
			return false;
		}
        protected override void OnPreInit(EventArgs e) {

            base.OnPreInit(e);

            if (PackageHelpers.UmbracoVersion != "7.2.2") return;

            // Handle authentication stuff to counteract bug in Umbraco 7.2.2 (see U4-6342)
            HttpContextWrapper http = new HttpContextWrapper(Context);
            FormsAuthenticationTicket ticket = http.GetUmbracoAuthTicket();
            http.AuthenticateCurrentRequest(ticket, true);

        }
示例#3
0
        /// <summary>
        /// Authenticates the request by reading the FormsAuthentication cookie and setting the 
        /// context and thread principle object
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// We will set the identity, culture, etc... for any request that is:
        /// * A back office request
        /// * An installer request
        /// * A /base request (since these can be back office web service requests)
        /// </remarks>
        static void AuthenticateRequest(object sender, EventArgs e)
        {
            var app = (HttpApplication)sender;
            var http = new HttpContextWrapper(app.Context);

            // do not process if client-side request
            if (http.Request.Url.IsClientSideRequest())
                return;

            var req = new HttpRequestWrapper(app.Request);

            if (ShouldAuthenticateRequest(req, UmbracoContext.Current.OriginalRequestUrl))
            {
                var ticket = http.GetUmbracoAuthTicket();

                http.AuthenticateCurrentRequest(ticket, ShouldIgnoreTicketRenew(UmbracoContext.Current.OriginalRequestUrl, http) == false);
            }

        }