/// <summary>
        /// Logout the specified currentUser.
        /// </summary>
        /// <returns>The logout result.</returns>
        /// <param name="currentUser">User to be logged out.</param>
        public async Task <bool> Logout(User currentUser)
        {
            NonNull(currentUser, "current user");
            string identityToken = currentUser.IdentityToken;
            var    logoutUrl     = keycloakConfig.LogoutUrl(identityToken, authenticationConfig.RedirectUri.ToString());

            TaskCompletionSource <bool> completionSource = new TaskCompletionSource <bool>();
            IHttpResponse response = await httpService.NewRequest().Get(logoutUrl).Execute();

            if (response.StatusCode == (int)HttpStatusCode.OK || response.StatusCode == (int)HttpStatusCode.Redirect)
            {
                credentialManager.Clear();
                completionSource.TrySetResult(true);
            }
            else
            {
                Exception error = response.Error;
                if (error == null)
                {
                    error = new Exception("Non HTTP 200 or 302 status code");
                }
                completionSource.TrySetException(error);
            }
            return(await completionSource.Task);
        }