コード例 #1
0
        /// <inheritdoc/>
        public async Task <IAuthenticationResponse> ForgotPasswordAsync(ForgotPasswordOptions forgotPasswordOptions, CancellationToken cancellationToken = default)
        {
            var forgotPasswordRequest = new ForgotPasswordRequest()
            {
                Username   = forgotPasswordOptions.UserName,
                RelayState = forgotPasswordOptions.RelayState,
                FactorType = forgotPasswordOptions.FactorType,
            };

            var request = new HttpRequest
            {
                Uri     = "/api/v1/authn/recovery/password",
                Payload = forgotPasswordRequest,
            };

            if (!string.IsNullOrEmpty(forgotPasswordOptions.UserAgent))
            {
                request.Headers["User-Agent"] = forgotPasswordOptions.UserAgent;
            }

            if (!string.IsNullOrEmpty(forgotPasswordOptions.XForwardedFor))
            {
                request.Headers["X-Forwarded-For"] = forgotPasswordOptions.XForwardedFor;
            }

            return(await PostAsync <AuthenticationResponse>(request, cancellationToken).ConfigureAwait(false));
        }
コード例 #2
0
        /// <inheritdoc/>
        public async Task <IAuthenticationResponse> ForgotPasswordAsync(ForgotPasswordOptions forgotPasswordOptions, CancellationToken cancellationToken = default(CancellationToken))
        {
            var forgotPasswordRequest = new ForgotPasswordRequest()
            {
                Username   = forgotPasswordOptions.UserName,
                RelayState = forgotPasswordOptions.RelayState,
                FactorType = forgotPasswordOptions.FactorType,
            };

            return(await PostAsync <AuthenticationResponse>(
                       new HttpRequest
            {
                Uri = "/api/v1/authn/recovery/password",
                Payload = forgotPasswordRequest,
            }, cancellationToken).ConfigureAwait(false));
        }