Exemple #1
0
        protected void Application_PostAuthenticateRequest(Object sender, EventArgs e)
        {
            var userToken = GetUserTokenFromRequest();

            if (!string.IsNullOrEmpty(userToken))
            {
                var user = RsaHelper.ParseSecureToken(userToken, ConfigurationManager.AppSettings["privateKeyPath"]);

                //var stubUserView = new AuthorizedUserView()
                //{
                //    Department = Departments.ADMIN,
                //    FirstName = "Fname",
                //    LastName = "Lname",
                //    Login = "******",
                //    UserId = 10,
                //};

                var principal = SecurityHelper.BuildPrincipal(user, userToken);
                Thread.CurrentPrincipal = principal;
                if (HttpContext.Current != null)
                {
                    HttpContext.Current.User = principal;
                }
            }
        }