Exemple #1
0
        /// <inheritdoc/>
        public async Task <IAuthenticationResponse> AuthenticateAsync(AuthenticateWithActivationTokenOptions authenticateOptions, CancellationToken cancellationToken = default)
        {
            var authenticationRequest = new AuthenticationRequest()
            {
                ActivationToken = authenticateOptions.ActivationToken,
            };

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

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

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

            return(await PostAsync <AuthenticationResponse>(request, cancellationToken).ConfigureAwait(false));
        }
        /// <inheritdoc/>
        public async Task <IAuthenticationResponse> AuthenticateAsync(AuthenticateWithActivationTokenOptions authenticateOptions, CancellationToken cancellationToken = default(CancellationToken))
        {
            var authenticationRequest = new AuthenticationRequest()
            {
                ActivationToken = authenticateOptions.ActivationToken,
            };

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