Exemple #1
0
        public AuthenticatorService(IOptions <AuthenticatorServiceOptions> options, ISystemTime systemTime)
        {
            options.CheckArgumentNull(nameof(options));
            systemTime.CheckArgumentNull(nameof(systemTime));

            options.Value.Issuer.CheckMandatoryOption(nameof(options.Value.Issuer));

            if (options.Value.NumberOfDigits < 6 || options.Value.NumberOfDigits > 8)
            {
                throw new ArgumentException(Resources.Exception_InvalidNumberOfDigits);
            }

            if (options.Value.PeriodInSeconds < 30)
            {
                throw new ArgumentException(Resources.Exception_InvalidPeriodInSeconds);
            }

            _options    = options.Value;
            _systemTime = systemTime;
        }