Exemplo n.º 1
0
 public OtpService(IUserRepository userRepository, IOtpRepository otpRepository, IOtpGenerator otpGenerator, ISmsSender smsSender)
 {
     _userRepository = userRepository;
     _otpGenerator   = otpGenerator;
     _smsSender      = smsSender;
     _otpRepository  = otpRepository;
 }
Exemplo n.º 2
0
 public OtpSender(IOtpRepository otpRepository, IOtpGenerator otpGenerator, ISmsClient smsClient, OtpProperties otpProperties)
 {
     this.otpRepository = otpRepository;
     this.otpGenerator  = otpGenerator;
     this.smsClient     = smsClient;
     this.otpProperties = otpProperties;
 }
Exemplo n.º 3
0
 public OtpAppService(ISmsGateway smsGateway, IEmailSender emailSender, IOtpStorage otpStorage, IOtpGenerator passwordGenerator, ISettingManager settingManager, IOtpSettings otpSettings)
 {
     _smsGateway     = smsGateway;
     _emailSender    = emailSender;
     _otpStorage     = otpStorage;
     _otpGenerator   = passwordGenerator;
     _settingManager = settingManager;
     _otpSettings    = otpSettings;
 }
Exemplo n.º 4
0
        public void TestInitialize()
        {
            container = new UnityContainer();

            container
            .RegisterType <IOtpGenerator, OtpGenerator>();

            otpGenerator = container.Resolve <IOtpGenerator>();
        }
Exemplo n.º 5
0
        public void TestInitialize()
        {
            AppDomain.CurrentDomain.SetData("DataDirectory", AppDomain.CurrentDomain.BaseDirectory);

            container = new UnityContainer();

            container
            .RegisterType <IDataAccessAdapter, DataAccessAdapter>()
            .RegisterType <IRepository <User>, UserRepository>()
            .RegisterType <IOtpGenerator, OtpGenerator>()
            .RegisterType <ILogger, FakeLogger>()
            .RegisterType <ICredentialsManager <ApplicationRule>, CredentialsManager>();

            application  = container.Resolve <ICredentialsManager <ApplicationRule> >();
            otpGenerator = container.Resolve <IOtpGenerator>();
        }
Exemplo n.º 6
0
 public CredentialsManager(IRepository <User> userRepository, IOtpGenerator otpGenerator, ILogger logger)
 {
     _userRepo     = userRepository;
     _otpGenerator = otpGenerator;
     _logger       = logger;
     if (_userRepo == null)
     {
         throw new NullReferenceException("User Repository must be initialized");
     }
     if (_otpGenerator == null)
     {
         throw new NullReferenceException("Otp Generator must be initialized");
     }
     if (_logger == null)
     {
         throw new NullReferenceException("Logger must be initialized");
     }
 }
Exemplo n.º 7
0
 public OtpGeneratorsController(IOtpGenerator repository, IMapper mapper)
 {
     _repository = repository;
     _mapper     = mapper;
 }
Exemplo n.º 8
0
 /// <summary>
 ///     Initializes a new instance of AuthenticationService class.
 /// </summary>
 /// <param name="otpGenerator">The one-time password generator.</param>
 public AuthenticationService(IOtpGenerator otpGenerator)
 {
     this.otpGenerator = otpGenerator;
 }
Exemplo n.º 9
0
 public OtpService(ICosmos db, IOtpGenerator otpGenerator, ISmsSender smsSender)
 {
     _db           = db;
     _otpGenerator = otpGenerator;
     _smsSender    = smsSender;
 }
Exemplo n.º 10
0
 /// <summary>
 ///     Initializes a new instance of the CounterBasedOtpGenerator class.
 /// </summary>
 /// <param name="username">Usually a cryptographically secure key, I've altered the algorithm to take a username to fit the specs</param>
 /// <param name="otpLength">The number of digits in the OTP to generate.</param>
 /// <param name="hmacAlgorithm">The hashing algorithm to use.</param>
 public OathTimeOtpGenerator(byte[] username, int otpLength, IHMACAlgorithm hmacAlgorithm)
 {
     _otpGenerator = new OathOtpGenerator(username, otpLength, hmacAlgorithm);
 }
Exemplo n.º 11
0
 public PassService(IOtpGenerator otpGenerator)
 {
     _otpGenerator = otpGenerator;
 }