示例#1
0
 public OTPService(IOTPAlgorithm otpAlgorithm, IMovingFactorAlgorithm movingFactorAlgorithm,
                   IErrorFactory errorFactory, OTPConfiguration otpConfiguration)
 {
     _otpAlgorithm          = otpAlgorithm;
     _movingFactorAlgorithm = movingFactorAlgorithm;
     _errorFactory          = errorFactory;
     _otpConfiguration      = otpConfiguration;
 }
示例#2
0
 public OTPService(IOTPAlgorithm otpAlgorithm, IMovingFactorAlgorithm movingFactorAlgorithm,
     IErrorFactory errorFactory, OTPConfiguration otpConfiguration)
 {
     _otpAlgorithm = otpAlgorithm;
     _movingFactorAlgorithm = movingFactorAlgorithm;
     _errorFactory = errorFactory;
     _otpConfiguration = otpConfiguration;
 }
 protected override void ConfigureApplicationContainer(TinyIoCContainer container)
 {
     base.ConfigureApplicationContainer(container);
     var otpConfiguration = new OTPConfiguration()
     {
         NumberOfDigitsInOTP = Convert.ToInt32(ConfigurationManager.AppSettings["NumberOfDigitsInOTP"]),
         OTPExpiryInSeconds = Convert.ToInt64(ConfigurationManager.AppSettings["OTPExpiryInSeconds"])
     };
     container.Register(otpConfiguration);
     container.Register<IOTPService,OTPService>();
     container.Register<IOTPAlgorithm,HmacBasedOTPAlgorithm>();
     container.Register<IErrorFactory,ErrorFactory>();
     container.Register<IMovingFactorAlgorithm>(new ExpiryBasedMovingFactorAlgorithm(otpConfiguration));
 }