Exemplo n.º 1
0
        public AuthStrategyContext GetAuthStrategyContext(string userName)
        {
            if (string.IsNullOrWhiteSpace(userName))
            {
                return(null);
            }
            IAuthStrategy authStrategy;

            if (userName == DefineConstant.SYSTEM_USERNAME)
            {
                authStrategy = _systemAuthStrategy;
            }
            else
            {
                authStrategy      = _normalAuthStrategy;
                authStrategy.user = _unitWork.First <User>(x => x.Account == userName);
            }
            return(new AuthStrategyContext(authStrategy));
        }