Return-Path: X-Original-To: apmail-hc-httpclient-users-archive@www.apache.org Delivered-To: apmail-hc-httpclient-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5DD9C1843B for ; Tue, 22 Mar 2016 13:40:34 +0000 (UTC) Received: (qmail 71437 invoked by uid 500); 22 Mar 2016 13:40:34 -0000 Delivered-To: apmail-hc-httpclient-users-archive@hc.apache.org Received: (qmail 71078 invoked by uid 500); 22 Mar 2016 13:40:33 -0000 Mailing-List: contact httpclient-users-help@hc.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-users@hc.apache.org Received: (qmail 71067 invoked by uid 99); 22 Mar 2016 13:40:33 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Mar 2016 13:40:33 +0000 Received: from ok2c (unknown [185.25.95.132]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id E3C3B1A003F for ; Tue, 22 Mar 2016 13:40:32 +0000 (UTC) Message-ID: <1458654029.21066.10.camel@apache.org> Subject: Re: CredentialsProvider From: Oleg Kalnichevski To: HttpClient User Discussion Date: Tue, 22 Mar 2016 14:40:29 +0100 In-Reply-To: <014592c050214a3d9b0820a21b20e2a0@MailCorp01.ocie.net> References: <014592c050214a3d9b0820a21b20e2a0@MailCorp01.ocie.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit On Mon, 2016-03-21 at 12:46 +0000, Mark A. Claassen wrote: > I am testing several different configurations of proxy authentication using the CredentialsProvider. It seems that the way this is done is to cache the Credentials, which make sense. However, how do I tell if they are incorrect? > > For instance, if I type my user name and password correctly, the caching works perfectly and I don't get prompted again. However, if I type them incorrectly, the incorrect credentials are cached and I don't get opportunity to re-enter the values. Is there a way to tell that a credential has been rejected so that I know to not cache it? > > Thanks, > Mark Hi Mark, Valid credentials that are known to have been accepted by the opposite endpoint(s) are cached by AuthCache [1] Invalidated credentials get automatically removed from the AuthCache allowing the CredentialsProvider to provide new creds. How exactly credentials are managed by a particular CredentialsProvider implementation HttpClient makes no assumptions of. As far as BasicCredentialsProvider is concerned one must manually remove invalid credentials from its internal map in case of 401 or 407 response from the opposite endpoint. Oleg [1] http://hc.apache.org/httpcomponents-client-4.5.x/httpclient/apidocs/org/apache/http/client/AuthCache.html --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org For additional commands, e-mail: httpclient-users-help@hc.apache.org