public AuthenticationService(IProfile profile, IRsaTokenDao token, IConsoleLog consoleLog)
        {
            _consoleLog = consoleLog;
            _profile = profile;
            _token = token;

        }
 public AuthenticationService(
     IProfileDao profileDao, 
     IRsaTokenDao rsaToken)
 {
     this.profileDao = profileDao;
     this.rsaToken = rsaToken;
 }
        public bool IsValid(string account, string password, IProfileDao profile, IRsaTokenDao rsaToken)
        {
            // 根據 account 取得自訂密碼
            profile = new ProfileDao();
            var passwordFromDao = profile.GetPassword(account);

            // 根據 account 取得 RSA token 目前的亂數
            rsaToken = new RsaTokenDao();
            var randomCode = rsaToken.GetRandom(account);

            // 驗證傳入的 password 是否等於自訂密碼 + RSA token亂數
            var validPassword = passwordFromDao + randomCode;
            var isValid = password == validPassword;

            return isValid;
        }
예제 #4
0
 public void Init()
 {
     _fakeRsaTokenDao = Substitute.For <IRsaTokenDao>();
     _fakeProfileDao  = Substitute.For <IProfileDao>();
     _logService      = Substitute.For <ILogService>();
 }
 public Lab1AuthenticationService(IProfileDao profileDao, IRsaTokenDao rsaTokenDao, ILogService logService)
 {
     _profileDao  = profileDao;
     _rsaTokenDao = rsaTokenDao;
     _logService  = logService;
 }
예제 #6
0
 public AuthenticationService(IProfileDao profileDao, IRsaTokenDao tokenDao)
 {
     this._profileDao = profileDao;
     this._tokenDao = tokenDao;
 }
 public AuthenticationService(IProfileDao profileDao, IRsaTokenDao rsaToken)
 {
     this.profileDao = profileDao;
     this.rsaToken   = rsaToken;
 }