public ProfileControllerTests(ProfileFixture fixture) { _controller = fixture.Scope.ServiceProvider.GetService <ProfileController>(); _dao = fixture.Scope.ServiceProvider.GetService <IProfileDao>(); _attribute = fixture.Attribute; _profile = fixture.Profile; }
public AuthenticationService( IProfileDao profileDao, IRsaTokenDao rsaToken) { this.profileDao = profileDao; this.rsaToken = rsaToken; }
public AuthenticationService(IProfileDao profileDao, IFailedCounter failedCounter, ISlackAdapter slackAdapter, ISha256Adapter sha256Adapter, IOtpService otpService, ILogger logger) { _profileDao = profileDao; _failedCounter = failedCounter; _slackAdapter = slackAdapter; _sha256Adapter = sha256Adapter; _otpService = otpService; _logger = logger; }
public void SetUp() { _fakeProfileDao = Substitute.For <IProfileDao>(); _fakeHash = Substitute.For <IHash>(); _fakeOtp = Substitute.For <IOtp>(); _authenticationService = new AuthenticationService(_fakeProfileDao, _fakeHash, _fakeOtp); GivenPassword(DefaultAccountId, DefaultPassword); GivenHashedPassword(DefaultPassword, DefaultPassword); GivenCurrentOtp(DefaultOtp); }
public bool IsValid(string account, string password, IProfileDao profile, IRsaToken rsaToken) { // 根據 account 取得自訂密碼 var passwordFromDao = profile.GetPassword(account); // 根據 account 取得 RSA token 目前的亂數 var randomCode = rsaToken.GetRandom(account); // 驗證傳入的 password 是否等於自訂密碼 + RSA token亂數 var validPassword = passwordFromDao + randomCode; var isValid = password == validPassword; return isValid; }
public void Setup() { _ProfileDao = Substitute.For <IProfileDao>(); _Otp = Substitute.For <IOtp>(); _Hash = Substitute.For <IHash>(); _FailCounter = Substitute.For <IFailCounter>(); _Notification = Substitute.For <INotification>(); _Logger = Substitute.For <ILogger>(); _AuthenticationService = new AuthenticationService(_ProfileDao, _Hash, _Otp); //composite _AuthenticationService = new NotificationDecorator(_AuthenticationService, _Notification); _AuthenticationService = new LogFailedCountDecorator(_AuthenticationService, _FailCounter, _Logger); _AuthenticationService = new FailedCounterDecorator(_AuthenticationService, _FailCounter); }
public bool IsValid(string account, string password, IProfileDao profile, IRsaToken rsaToken) { // 根據 account 取得自訂密碼 var passwordFromDao = profile.GetPassword(account); // 根據 account 取得 RSA token 目前的亂數 var randomCode = rsaToken.GetRandom(account); // 驗證傳入的 password 是否等於自訂密碼 + RSA token亂數 var validPassword = passwordFromDao + randomCode; var isValid = password == validPassword; return(isValid); }
public ProfileController(IEnumerable <IProvider <Message> > providers, ITelegramBotClient telegram, IProfileDao dao) : base(providers) { _telegram = telegram; _dao = dao; NewAttribute(); NewProfile(); AddProfileAlias(); AddProfileKarma(); SetProfileAttributeValue(); ListAttributes(); ShowAttributeValues(); ShowTop(); ShowProfile(); }
public void IsValidTest() { //var stubProfile = new StubProfileDao(); IProfileDao stubProfile = Substitute.For <IProfileDao>(); stubProfile.GetPassword("joey").Returns("91"); //var stubToken = new StubTokenDao(); IRsaToken stubToken = Substitute.For <IRsaToken>(); stubToken.GetRandom("").ReturnsForAnyArgs("000000"); var target = new AuthenticationService(stubProfile, stubToken); var actual = target.IsValid("joey", "91000000"); Assert.IsTrue(actual); }
public void Test_IsValid_joey_1234666666_Should_Return_True() { var target = new AuthService(); var account = "cash"; var password = "******"; IProfileDao stubProfileDao = Substitute.For <IProfileDao>(); stubProfileDao.GetPassword("cash").ReturnsForAnyArgs("1234"); stubProfileDao.GetToken("cash").ReturnsForAnyArgs("666666"); target.MyProfileDao = stubProfileDao; var actual = target.IsValid(account, password); var expected = true; actual.Should().Be(expected); }
public AuthenticationService(IProfileDao profileDao, IRsaToken rsaToken) { this.profileDao = profileDao; this.rsaToken = rsaToken; }
private ProfileService() { _daoManager = ServiceConfig.GetInstance().DaoManager; _Dao = (IProfileDao)_daoManager.GetDao(typeof(IProfileDao)); }
public void Init() { _fakeRsaTokenDao = Substitute.For <IRsaTokenDao>(); _fakeProfileDao = Substitute.For <IProfileDao>(); _logService = Substitute.For <ILogService>(); }
public ProfileDaoTests(ProfileFixture fixture) { _dao = fixture.Scope.ServiceProvider.GetService <IProfileDao>(); _attribute = fixture.Attribute; _profile = fixture.Profile; }
public AuthenticationService(IProfileDao profileDao, IHash sha256Adapter, IOtp otpService) { _profileDao = profileDao; _sha256Adapter = sha256Adapter; _otpService = otpService; }
public ProfileLogic(IProfileDao profileDao) { this._profileDao = profileDao; }
public AuthenticationService(IProfileDao profileDao, ITokenDao tokenDao) { this._profileDao = profileDao; this._tokenDao = tokenDao; }
public Lab1AuthenticationService(IProfileDao profileDao, IRsaTokenDao rsaTokenDao, ILogService logService) { _profileDao = profileDao; _rsaTokenDao = rsaTokenDao; _logService = logService; }
public AuthenticationService() { _ProfileDao = new ProfileDao(); _Hash = new Sha256Adapter(); _Otp = new Otp(); }
public AuthenticationService(IProfileDao profileDao, IHash hash, IOtp otp) { _ProfileDao = profileDao; _Hash = hash; _Otp = otp; }