예제 #1
0
        /// <summary>
        /// OnInit
        /// Authentication is implemented in this method
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            var sessionId = Request.QueryString["session"];

            AuthenticatedUser = SignOnHelper.GetStoredUserSignOnResult(sessionId);
            if (ConfigurationHelper.IsOnPremise)
            {
                CommonUtil.ValidateFileName(sessionId);
                CommonUtil.ValidatePathName(RegistryHelper.SharedDataDirectory);
                var path = Path.Combine(RegistryHelper.SharedDataDirectory, string.Format("{0}.auth", 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);
        }
예제 #2
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);
        }
예제 #3
0
        /// <summary>
        /// Determines whether [is user authenticated].
        /// </summary>
        /// <param name="sessionId">Session Id</param>
        /// <returns></returns>
        public static bool IsUserAuthenticated(string sessionId)
        {
            var userTenantInfo = SignOnHelper.GetStoredUserSignOnResult(sessionId);

            return(userTenantInfo != null);
        }