Exemplo n.º 1
0
 public AuthenticationService(IProfile profile,
                              IHash hash, IOtp otpRemoteProxy)
 {
     _profile        = profile;
     _hash           = hash;
     _otpRemoteProxy = otpRemoteProxy;
 }
 public AuthenticationService(IProfile profile,
                              IHash hash, IOtp otp)
 {
     _profile = profile;
     _hash    = hash;
     _otp     = otp;
 }
Exemplo n.º 3
0
 //alt + insert
 public AuthenticationService(IProfile profile, IHash hash, IOtp otpService, INotification notification, IFailedCounter failedCounter, ILogger logger)
 {
     _Profile       = profile;
     _Hash          = hash;
     _OtpService    = otpService;
     _Notification  = notification;
     _FailedCounter = failedCounter;
     _Logger        = logger;
 }
Exemplo n.º 4
0
 public AuthenticationService()
 {
     _Profile       = new ProfileDao();
     _Hash          = new Sha256Adapter();
     _OtpService    = new OtpService();
     _Notification  = new SlackAdapter();
     _FailedCounter = new FailedCounter();
     _Logger        = new NLogAdapter();
 }
        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 void Setup()
        {
            _ProfileDao            = Substitute.For <IProfile>();
            _Otp                   = Substitute.For <IOtp>();
            _Hash                  = Substitute.For <IHash>();
            _FailCounter           = Substitute.For <IFailedCounter>();
            _Notification          = Substitute.For <INotification>();
            _Logger                = Substitute.For <ILogger>();
            _AuthenticationService = new AuthenticationService(_ProfileDao, _Hash, _Otp, _Notification, _FailCounter, _Logger);

            _AuthenticationService = new FailedCounterDecorator(_AuthenticationService, _FailCounter);
            _AuthenticationService = new LogFailedCounterDecorator(_AuthenticationService, _Logger, _FailCounter);
            _AuthenticationService = new NotificationDecorator(_AuthenticationService, _Notification);
        }
        public void SetUp()
        {
            _profile       = Substitute.For <IProfile>();
            _otpService    = Substitute.For <IOtp>();
            _notification  = Substitute.For <INotification>();
            _failedCounter = Substitute.For <IFailedCounter>();
            _logger        = Substitute.For <ILogger>();
            _hash          = Substitute.For <IHash>();
            var authenticationService  = new AuthenticationService(_profile, _hash, _otpService);
            var failedCounterDecorator = new FailedCounterDecorator(authenticationService, _failedCounter);
            var logDecorator           = new LogDecorate(failedCounterDecorator, _failedCounter, _logger);

            _authenticationService = new NotifyDecorator(logDecorator, _notification);
        }
        public void Setup()
        {
            //Use NSubstitute to mock objects.
            _profile        = Substitute.For <IProfile>();
            _otpRemoteProxy = Substitute.For <IOtp>();
            _hash           = Substitute.For <IHash>();
            _notification   = Substitute.For <INotification>();
            _failedCounter  = Substitute.For <IFailedCounter>();
            _logger         = Substitute.For <ILogger>();

            var authenticationService = new AuthenticationService(_profile, _hash, _otpRemoteProxy);
            var notificationDecorator = new NotificationDecorator(authenticationService, _notification);
            var logDecorator          = new FailedCounterDecorator(notificationDecorator, _failedCounter);

            _authentication = new LogDecorator(logDecorator, _failedCounter, _logger);
        }
        public void Setup()
        {
            _logger        = Substitute.For <ILogger>();
            _profile       = Substitute.For <IProfile>();
            _optService    = Substitute.For <IOtp>();
            _hash          = Substitute.For <IHash>();
            _notification  = Substitute.For <INotification>();
            _failedCounter = Substitute.For <IFailedCounter>();
            _apiCountQuota = Substitute.For <IApiCountQuota>();

            var authenticationService = new AuthenticationService(_profile, _hash, _optService);
            var notificationDecorator = new NotificationDecorator(authenticationService, _notification);
            var failedCountDecorator  = new FailedCountDecorator(notificationDecorator, _failedCounter);
            var logDecorator          = new LogDecorator(failedCountDecorator, _logger, _failedCounter);
            var apiCallQuotaDecorator = new ApiCallQuotaDecorator(logDecorator, _apiCountQuota);

            _authentication = apiCallQuotaDecorator;
        }
Exemplo n.º 10
0
        public void SetUp()
        {
            _profile        = Substitute.For <IProfile>();
            _otp            = Substitute.For <IOtp>();
            _hash           = Substitute.For <IHash>();
            _notification   = Substitute.For <INotification>();
            _logger         = Substitute.For <ILogger>();
            _failedCounter  = Substitute.For <IFailedCounter>();
            _apiUserQuotaV2 = Substitute.For <IApiUserQuotaV2>();
            var authenticationService =
                new AuthenticationService(_profile, _hash, _otp);

            var checkUseTimeDecorator  = new ApiCheckTimeDecorator(authenticationService, _apiUserQuotaV2);
            var notificationDecorator  = new NotificationDecorator(checkUseTimeDecorator, _notification, _logger);
            var failedCounterDecorator = new FailedCounterDecorator(notificationDecorator, _failedCounter);
            var logDecorator           = new LogDecorator(failedCounterDecorator, _failedCounter, _logger);

            _authentication = logDecorator;
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            RegisterContainer();

            _logger                = new FakeLogger();
            _failedCounter         = new FakeFailedCounter();
            _notification          = new FakeSlack();
            _otpService            = new FakeOtp();
            _hash                  = new FakeHash();
            _profile               = new FakeProfile();
            _authenticationService =
                new AuthenticationService(_profile, _hash, _otpService, _notification, _failedCounter, _logger);

            //_authenticationService = new FailedCounterDecorator(_authenticationService, _failedCounter);
            //_authenticationService = new LogFailedCounterDecorator(_authenticationService, _logger, _failedCounter);
            //_authenticationService = new NotificationDecorator(_authenticationService, _notification);

            var isValid = _authenticationService.Verify("joey", "abc", "wrong otp");

            Console.WriteLine($"result is {isValid}");
        }
Exemplo n.º 12
0
 public AuthenticationService(IProfileDao profileDao, IHash hash, IOtp otp)
 {
     _ProfileDao = profileDao;
     _Hash       = hash;
     _Otp        = otp;
 }
Exemplo n.º 13
0
 public AuthenticationService()
 {
     _ProfileDao = new ProfileDao();
     _Hash       = new Sha256Adapter();
     _Otp        = new Otp();
 }
 public AuthenticationService(IProfile profile, IHash hash, IOtp optService)
 {
     _profile    = profile;
     _hash       = hash;
     _optService = optService;
 }
 public AuthenticationService()
 {
     _profile    = new ProfileRepo();
     _hash       = new Sha256Adapter();
     _optService = new OptService();
 }
Exemplo n.º 16
0
 public AuthenticationService(IProfileDao profileDao, IHash sha256Adapter, IOtp otpService)
 {
     _profileDao    = profileDao;
     _sha256Adapter = sha256Adapter;
     _otpService    = otpService;
 }