summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2014-03-26 23:16:36 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2014-04-14 00:42:05 +0200
commita53a18e988714cd87934d1a7e29b3331b37542a8 (patch)
tree2a2160749867b4aa992329c85e06bfbedce7be44
parent5073000c3f90d4c9e526a5dffecf37c920dc6775 (diff)
downloadjgit-a53a18e988714cd87934d1a7e29b3331b37542a8.tar.gz
jgit-a53a18e988714cd87934d1a7e29b3331b37542a8.zip
Ensure that stored credentials aren't reset too early
Some commands are started without showing a dialog allowing to enter credentials if needed. Hence we need to tolerate one failing HTTP authentication to trigger loading credentials from the secure store. Hence we should not immediately reset the stored credentials if the first attempt to authenticate fails. Bug: 431209 Change-Id: I1b9fa34c3d70be226bb1c59c9ebe995998d29bc8 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java4
1 files changed, 2 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
index 5885e7b528..83ad971f78 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportHttp.java
@@ -472,13 +472,13 @@ public class TransportHttp extends HttpTransport implements WalkTransport,
throw new TransportException(uri, MessageFormat.format(
JGitText.get().authenticationNotSupported, uri));
CredentialsProvider credentialsProvider = getCredentialsProvider();
+ if (authAttempts > 1)
+ credentialsProvider.reset(uri);
if (3 < authAttempts
|| !authMethod.authorize(uri, credentialsProvider)) {
- credentialsProvider.reset(uri);
throw new TransportException(uri,
JGitText.get().notAuthorized);
}
- credentialsProvider.reset(uri);
authAttempts++;
continue;