Package org.eclipse.jgit.transport
Class CredentialsProvider
java.lang.Object
org.eclipse.jgit.transport.CredentialsProvider
- Direct Known Subclasses:
AwtCredentialsProvider,ChainingCredentialsProvider,ConsoleCredentialsProvider,NetRCCredentialsProvider,UsernamePasswordCredentialsProvider
Provide credentials for use in connecting to Git repositories.
Implementors are strongly encouraged to support at least the minimal
CredentialItem.Username and
CredentialItem.Password items. More
sophisticated implementors may implement additional types, such as
CredentialItem.StringType.
CredentialItems are usually presented in bulk, allowing implementors to
combine them into a single UI widget and streamline the authentication
process for an end-user.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanget(URIish uri, List<CredentialItem> items) Ask for the credential items to be populated.abstract booleanget(URIish uri, CredentialItem... items) Ask for the credential items to be populated.static CredentialsProviderGet the default credentials provider, or null.protected static booleanisAnyNull(CredentialItem... items) Whether any of the passed items is nullabstract booleanCheck if the provider is interactive with the end-user.voidReset the credentials provider for the given URIstatic voidSet the default credentials provider.abstract booleansupports(CredentialItem... items) Check if the provider can supply the necessaryCredentialItems.
-
Field Details
-
defaultProvider
-
-
Constructor Details
-
CredentialsProvider
public CredentialsProvider()
-
-
Method Details
-
getDefault
Get the default credentials provider, or null.- Returns:
- the default credentials provider, or null.
-
setDefault
Set the default credentials provider.- Parameters:
p- the new default provider, may be null to select no default.
-
isAnyNull
Whether any of the passed items is null- Parameters:
items- credential items to check- Returns:
trueif any of the passed items is null,falseotherwise- Since:
- 4.2
-
isInteractive
public abstract boolean isInteractive()Check if the provider is interactive with the end-user. An interactive provider may try to open a dialog box, or prompt for input on the terminal, and will wait for a user response. A non-interactive provider will either populate CredentialItems, or fail.- Returns:
trueif the provider is interactive with the end-user.
-
supports
Check if the provider can supply the necessaryCredentialItems.- Parameters:
items- the items the application requires to complete authentication.- Returns:
trueif thisCredentialsProvidersupports all of the items supplied.
-
get
Ask for the credential items to be populated.- Parameters:
uri- the URI of the remote resource that needs authentication.items- the items the application requires to complete authentication.- Returns:
trueif the request was successful and values were supplied;falseif the user canceled the request and did not supply all requested values.- Throws:
UnsupportedCredentialItem- if one of the items supplied is not supported.
-
get
Ask for the credential items to be populated.- Parameters:
uri- the URI of the remote resource that needs authentication.items- the items the application requires to complete authentication.- Returns:
trueif the request was successful and values were supplied;falseif the user canceled the request and did not supply all requested values.- Throws:
UnsupportedCredentialItem- if one of the items supplied is not supported.
-
reset
Reset the credentials provider for the given URI- Parameters:
uri- aURIishobject.
-