Ejemplo n.º 1
0
        public AuthStrategyContext GetAuthStrategyContext(string username)
        {
            if (string.IsNullOrEmpty(username))
            {
                return(null);
            }

            IAuthStrategy service = null;

            if (username == Define.SYSTEM_USERNAME)
            {
                service = _systemAuth;
            }
            else
            {
                service      = _normalAuthStrategy;
                service.User = _unitWork.FirstOrDefault <User>(u => u.Account == username);
            }

            return(new AuthStrategyContext(service));
        }