Exemplo n.º 1
0
        /// <summary>
        /// OnInit
        /// Authentication is implemented in this method
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            AuthenticatedUser = SignOnHelper.GetStoredUserSignOnResult();
            if (ConfigurationHelper.IsOnPremise)
            {
                var path = Path.Combine(RegistryHelper.SharedDataDirectory, string.Format("{0}.auth", HttpContext.Current.Session.SessionID));
                if (File.Exists(path))
                {
                    var userTenantInfo = File.ReadAllText(path);
                    File.Delete(path);
                    AuthenticatedUser = JsonSerializer.Deserialize <UserTenantInfo>(userTenantInfo);
                }
            }

            if (AuthenticatedUser == null)
            {
                Response.RedirectToRoute(new { area = "Core", controller = "Authentication", action = "Login" });
                Response.End();
            }

            base.OnInit(e);
        }