Merge "Define a default CredentialsProvider"

This commit is contained in:
Stefan Lay 2010-11-11 09:36:34 -05:00 committed by Code Review
commit 33c419fdfe
2 changed files with 18 additions and 0 deletions

View File

@ -63,6 +63,23 @@
* @see UsernamePasswordCredentialsProvider
*/
public abstract class CredentialsProvider {
private static volatile CredentialsProvider defaultProvider;
/** @return the default credentials provider, or null. */
public static CredentialsProvider getDefault() {
return defaultProvider;
}
/**
* Set the default credentials provider.
*
* @param p
* the new default provider, may be null to select no default.
*/
public static void setDefault(CredentialsProvider p) {
defaultProvider = p;
}
/**
* Check if the provider can supply the necessary {@link CredentialItem}s.
*

View File

@ -577,6 +577,7 @@ protected Transport(final Repository local, final URIish uri) {
this.local = local;
this.uri = uri;
this.checkFetchedObjects = tc.isFsckObjects();
this.credentialsProvider = CredentialsProvider.getDefault();
}
/**