Exemple #1
0
        /// <inheritdoc/>
        public Task <IFactor> AddFactorAsync(string userId, AddTokenFactorOptions tokenFactorOptions, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (tokenFactorOptions == null)
            {
                throw new ArgumentNullException(nameof(tokenFactorOptions));
            }

            if (tokenFactorOptions.Provider == null)
            {
                throw new ArgumentNullException(nameof(tokenFactorOptions.Provider));
            }

            var profile = new TokenFactorProfile
            {
                CredentialId = tokenFactorOptions.CredentialId
            };

            var verify = new VerifyFactorRequest
            {
                PassCode     = tokenFactorOptions.PassCode,
                NextPassCode = tokenFactorOptions.NextPassCode
            };

            var factor = new TokenFactor
            {
                FactorType = FactorType.Token,
                Provider   = tokenFactorOptions.Provider,
                Profile    = profile,
                Verify     = verify
            };

            return(AddFactorAsync(factor, userId, cancellationToken: cancellationToken));
        }
Exemple #2
0
 public Task <IFactor> AddFactorAsync(AddTokenFactorOptions tokenFactorOptions, CancellationToken cancellationToken = default(CancellationToken))
 => GetClient().UserFactors.AddFactorAsync(Id, tokenFactorOptions, cancellationToken);