예제 #1
0
        private static void context_BeginRequest(object sender, EventArgs e)
        {
            //从环境中(url)获取TenantCode
            TenantContext.Current.TenantCode = PassportManager.GetTenantCodeFromContext();

            HttpContext.Current.Items["IsDeluxeWorksAuthenticate"] = true;

            if (HttpContext.Current.Request.QueryString[AccessTicket.AccquireAccessTicketParamName].IsNotEmpty())
            {
                ProcessAccquireAccessTicket();
            }
        }
예제 #2
0
        private bool AreDifferentTenantCode()
        {
            bool result = false;

            string envTenantCode = PassportManager.GetTenantCodeFromContext();

            if (TenantContext.Current.Enabled && envTenantCode.IsNotEmpty())
            {
                result = string.Compare(envTenantCode, this.TenantCode, true) != 0;
            }

            return(result);
        }
        private ITicket CheckAuthenticatedAndGetTicket()
        {
            AuthenticateDirElement aDir =
                AuthenticateDirSettings.GetConfig().AuthenticateDirs.GetMatchedElement <AuthenticateDirElement>();

            bool autoRedirect = (aDir == null || aDir.AutoRedirect);

            PassportManager.CheckAuthenticated(autoRedirect);

            bool fromCookie = false;

            return(PassportManager.GetTicket(out fromCookie));
        }
예제 #4
0
        private ITicket CheckAuthenticatedAndGetTicket()
        {
            AuthenticateDirElement aDir =
                AuthenticateDirSettings.GetConfig().AuthenticateDirs.GetMatchedElement <AuthenticateDirElement>();

            bool autoRedirect = (aDir == null || aDir.AutoRedirect);

            PassportManager.CheckAuthenticated(autoRedirect);

            TicketSource ticketSource = TicketSource.Unknown;

            return(PassportManager.GetTicket(out ticketSource));
        }
        private void DoLogOff()
        {
            PassportManager.ClearAppSignInCookie();

            HttpResponse response = HttpContext.Current.Response;

            response.Cache.SetCacheability(HttpCacheability.NoCache);
            response.Cache.SetExpires(SNTPClient.AdjustedTime.AddDays(-1));
            response.ContentType = "image/gif";
            try
            {
                Resource.success.Save(response.OutputStream, ImageFormat.Gif);
            }
            catch (System.Exception)
            {
                Resource.fail.Save(response.OutputStream, ImageFormat.Gif);
            }
            finally
            {
                response.AddHeader("P3P", "CP-TST");
                response.Flush();
                response.End();
            }
        }