Esempio n. 1
0
        /// <summary>
        /// Sends a new code via the selected channel.
        /// </summary>
        /// <param name="service">The service to use.</param>
        /// <param name="configureMessage">The delegate that will be used to build the message.</param>
        /// <exception cref="TotpServiceException">used to pass errors between service and the caller.</exception>
        public static Task <TotpResult> Send(this ITotpService service, Action <TotpMessageBuilder> configureMessage)
        {
            if (configureMessage == null)
            {
                throw new ArgumentNullException(nameof(configureMessage));
            }
            var messageBuilder = new TotpMessageBuilder();

            configureMessage(messageBuilder);
            var totpMessage = messageBuilder.Build();

            return(service.Send(totpMessage.ClaimsPrincipal, totpMessage.Message, totpMessage.DeliveryChannel, totpMessage.Purpose, totpMessage.SecurityToken, totpMessage.PhoneNumberOrEmail));
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a new instance of <see cref="TotpPurposeBuilder"/>.
 /// </summary>
 /// <param name="totpMessageBuilder">The instance of <see cref="TotpMessageBuilder"/>.</param>
 public TotpPhoneProviderBuilder(TotpMessageBuilder totpMessageBuilder)
 {
     _totpMessageBuilder = totpMessageBuilder ?? throw new ArgumentNullException(nameof(totpMessageBuilder));
 }
Esempio n. 3
0
 /// <summary>
 /// Creates a new instance of <see cref="TotpPurposeBuilder"/>.
 /// </summary>
 /// <param name="totpMessageBuilder">The instance of <see cref="TotpMessageBuilder"/>.</param>
 public TotpContactBuilder(TotpMessageBuilder totpMessageBuilder) : base(totpMessageBuilder)
 {
     _totpMessageBuilder = totpMessageBuilder ?? throw new ArgumentNullException(nameof(totpMessageBuilder));
 }