示例#1
0
        public AuthStrategyContext GetAuthStrategyContext(string username)
        {
            IAuthStrategy service = null;

            service      = _normalAuthStrategy;
            service.User = _unitWork.FindSingle <User>(u => u.Account == username);

            return(new AuthStrategyContext(service));
        }
示例#2
0
        public AuthStrategyContext GetAuthStrategyContext(string username)
        {
            IAuthStrategy service = null;

            if (username == "admin")
            {
                service = _systemAuth;
            }
            else
            {
                service      = _normalAuthStrategy;
                service.User = _unitWork.FindSingle <User>(u => u.Account == username);
            }

            return(new AuthStrategyContext(service));
        }
示例#3
0
        public AuthStrategyContext GetAuthStrategyContext(string username)
        {
            IAuthStrategy service = null;

            if (username == "System")
            {
                service = _systemAuth;
            }
            else
            {
                service      = _normalAuthStrategy;
                service.User = _unitWork.FindSingle <UserInfo>(u => u.Id == username);
            }

            return(new AuthStrategyContext(service)
            {
                CommonUtil = CommonUtil
            });
        }
示例#4
0
        public AuthStrategyContext GetAuthStrategyContext(string username)
        {
            IAuthStrategy service = null;

            service      = _normalAuthStrategy;
            service.User = _unitWork.FindSingle <User>(u => u.Account == username);

            // if (username == "System")
            //{
            //    service= _systemAuth;
            //}
            //else
            //{
            //    service = _normalAuthStrategy;
            //    service.User = _unitWork.FindSingle<User>(u => u.Account == username);
            //}

            return(new AuthStrategyContext(service));
        }
        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));
        }
 public AuthStrategyContext(IAuthStrategy strategy)
 {
     this._strategy = strategy;
 }
示例#7
0
 public Principal(IAuthStrategy strategy)
 {
     _strategy      = Assert.Argument(strategy, nameof(strategy)).NotNull().Value;
     _profileKey    = "Qoden.Auth.Custodian.Profile";
     _authOperation = new SingletonOperation <UserProfile>(RunFlow);
 }
示例#8
0
 public void setAuthStrategy(IAuthStrategy strategy)
 {
     this.strategy = strategy;
 }
示例#9
0
 public AuthProvider(IAuthStrategy strategy)
 {
     this.strategy = strategy;
 }