Example #1
0
        void Application_OnPostAuthenticateRequest(object sender, EventArgs e)
        {
            IPrincipal user = HttpContext.Current.User;


            if(user.Identity.IsAuthenticated && user.Identity.AuthenticationType=="Forms")
            {
                CustomPrincipal principal = null;
                principal = new CustomPrincipal(HttpContext.Current.User.Identity);
                HttpContext.Current.User = principal;
                Thread.CurrentPrincipal = principal;
            }

          
        }
Example #2
0
        public GetCustomerResponse GetCustomer()
        {
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                throw new FaultException <NotAuthenticatedFault>(new NotAuthenticatedFault());
            }
            GetCustomerResponse       response = new GetCustomerResponse();
            SecurityBusinessComponent sc       = DependencyInjectionHelper.GetSecurityBusinessComponent();

            HsrOrderApp.BL.Security.CustomPrincipal principal = HttpContext.Current.User as CustomPrincipal;
            if (principal == null)
            {
                return(response);
            }
            User user = sc.GetUserById(principal.User.UserId);
            CustomerBusinessComponent bc = DependencyInjectionHelper.GetCustomerBusinessComponent();
            Customer customer            = bc.GetCustomerById(user.Customer.CustomerId);

            response.Customer = CustomerAdapter.CustomerToDto(customer);

            return(response);
        }