예제 #1
0
        protected override bool IsAuthorized(HttpActionContext actionContext)
        {
            var identity = Thread.CurrentPrincipal.Identity;

            if (identity != null && identity.IsAuthenticated)
            {
                userGetService = new UserGetService(); //IOC

                var basicAuth = identity as BasicAuthenticationIdentity;

                User user = userGetService.Get(basicAuth.Name, basicAuth.Password);

                if (user != null)
                {
                    basicAuth.User = user;
                    SetPrincipal(Thread.CurrentPrincipal);
                    return(true);
                }
            }

            return(false);
        }
예제 #2
0
        //internal IUserGetService getService;


        public UserService()
        {
            getService    = new UserGetService();
            saveService   = new UserSaveService();
            deleteService = new UserDeleteService();
        }