Пример #1
0
        /// <inheritdoc/>
        public async Task <IAuthenticationResponse> UnlockAccountAsync(UnlockAccountOptions unlockAccountOptions, CancellationToken cancellationToken = default)
        {
            var unlockAccountRequest = new UnlockAccountRequest()
            {
                FactorType = unlockAccountOptions.FactorType,
                RelayState = unlockAccountOptions.RelayState,
                Username   = unlockAccountOptions.Username,
            };

            var request = new HttpRequest
            {
                Uri     = $"/api/v1/authn/recovery/unlock",
                Payload = unlockAccountRequest,
            };

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

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

            return(await PostAsync <AuthenticationResponse>(request, cancellationToken).ConfigureAwait(false));
        }
        /// <inheritdoc/>
        public async Task <IAuthenticationResponse> UnlockAccountAsync(UnlockAccountOptions unlockAccountOptions, CancellationToken cancellationToken = default(CancellationToken))
        {
            var unlockAccountRequest = new UnlockAccountRequest()
            {
                FactorType = unlockAccountOptions.FactorType,
                RelayState = unlockAccountOptions.RelayState,
                Username   = unlockAccountOptions.Username,
            };

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