示例#1
0
        /// <inheritdoc/>
        public Task <IUserFactor> AddFactorAsync(string userId, AddCustomHotpFactorOptions hotpFactorOptions, CancellationToken cancellationToken = default)
        {
            if (hotpFactorOptions == null)
            {
                throw new ArgumentNullException(nameof(hotpFactorOptions));
            }

            var factorProfile = new CustomHotpUserFactorProfile
            {
                SharedSecret = hotpFactorOptions.ProfileSharedSecret,
            };

            var factor = new CustomHotpUserFactor
            {
                FactorType      = FactorType.TokenHotp,
                Provider        = FactorProvider.Custom,
                FactorProfileId = hotpFactorOptions.FactorProfileId,
                Profile         = factorProfile,
            };

            return(EnrollFactorAsync(body: factor, userId: userId, activate: true, cancellationToken: cancellationToken));
        }
示例#2
0
 /// <inheritdoc/>
 public Task <IUserFactor> AddFactorAsync(AddCustomHotpFactorOptions hotpFactorOptions, CancellationToken cancellationToken = default)
 => GetClient().UserFactors.AddFactorAsync(Id, hotpFactorOptions, cancellationToken);