Package org.eclipse.jgit.transport
Class ChainingCredentialsProvider
- java.lang.Object
-
- org.eclipse.jgit.transport.CredentialsProvider
-
- org.eclipse.jgit.transport.ChainingCredentialsProvider
-
public class ChainingCredentialsProvider extends CredentialsProvider
A credentials provider chaining multiple credentials providers- Since:
- 3.5
-
-
Constructor Summary
Constructors Constructor Description ChainingCredentialsProvider(CredentialsProvider... providers)Create a new chaining credential provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanget(URIish uri, CredentialItem... items)Populates the credential items with the credentials provided by the first credential provider in the list which populates them with non-null valuesbooleanisInteractive()Check if the provider is interactive with the end-user.booleansupports(CredentialItem... items)Check if the provider can supply the necessaryCredentialItems.-
Methods inherited from class org.eclipse.jgit.transport.CredentialsProvider
get, getDefault, reset, setDefault
-
-
-
-
Constructor Detail
-
ChainingCredentialsProvider
public ChainingCredentialsProvider(CredentialsProvider... providers)
Create a new chaining credential provider. This provider tries to retrieve credentials from the chained credential providers in the order they are given here. If multiple providers support the requested items and have non-null credentials the first of them will be used.- Parameters:
providers- credential providers asked for credentials in the order given here
-
-
Method Detail
-
isInteractive
public boolean isInteractive()
Description copied from class:CredentialsProviderCheck 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.- Specified by:
isInteractivein classCredentialsProvider- Returns:
trueif any of the credential providers in the list is interactive, otherwisefalse- See Also:
CredentialsProvider.isInteractive()
-
supports
public boolean supports(CredentialItem... items)
Description copied from class:CredentialsProviderCheck if the provider can supply the necessaryCredentialItems.- Specified by:
supportsin classCredentialsProvider- Parameters:
items- the items the application requires to complete authentication.- Returns:
trueif any of the credential providers in the list supports the requested items, otherwisefalse- See Also:
CredentialsProvider.supports(org.eclipse.jgit.transport.CredentialItem[])
-
get
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem
Populates the credential items with the credentials provided by the first credential provider in the list which populates them with non-null values- Specified by:
getin classCredentialsProvider- Parameters:
uri- the URI of the remote resource that needs authentication.items- the items the application requires to complete authentication.- Returns:
trueif any of the credential providers in the list supports the requested items, otherwisefalse- Throws:
UnsupportedCredentialItem- if one of the items supplied is not supported.- See Also:
CredentialsProvider.supports(org.eclipse.jgit.transport.CredentialItem[])
-
-