Ejemplo n.º 1
0
        protected void Application_AuthenticateRequest()
        {
            IPrincipal user = HttpContext.Current.User;
            IAccountRepository accountRepository = new AccountRepository();
            if (user != null && user.Identity.IsAuthenticated && user.Identity.AuthenticationType.Equals("Forms"))
            {
                var formsIdentity = user.Identity as FormsIdentity;
                if (formsIdentity != null)
                {
                    var customIdentity = new CustomIdentity(formsIdentity.Ticket);
                    var customPrincipal = new CustomPrincipal(customIdentity, accountRepository);

                    HttpContext.Current.User = customPrincipal;
                    Thread.CurrentPrincipal = customPrincipal;
                }
            }
        }
Ejemplo n.º 2
0
 public CustomPrincipal(CustomIdentity identity, IAccountRepository accountRepository)
     : this()
 {
     _identity = identity;
     _accountRepository = accountRepository;
 }