Top Description Fields Constructors Methods
org.eclipse.jgit.transport

public abstract Class CredentialsProvider

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.jgit.transport.NetRCCredentialsProvider, org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider, org.eclipse.jgit.transport.ChainingCredentialsProvider
Imports
java.util.List, org.eclipse.jgit.errors.UnsupportedCredentialItem

Provide credentials for use in connecting to Git repositories. Implementors are strongly encouraged to support at least the minimal org.eclipse.jgit.transport.CredentialItem.Username and org.eclipse.jgit.transport.CredentialItem.Password items. More sophisticated implementors may implement additional types, such as org.eclipse.jgit.transport.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
UsernamePasswordCredentialsProvider

Field Summary

Modifier and TypeField and Description
private static volatile CredentialsProvider

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public abstract boolean

Returns:

true if the request was successful and values were supplied; false if the user canceled the request and did not supply all requested values.
get
(URIish
the URI of the remote resource that needs authentication.
uri
,
CredentialItem...
the items the application requires to complete authentication.
items
)

Ask for the credential items to be populated.

public boolean

Returns:

true if the request was successful and values were supplied; false if the user canceled the request and did not supply all requested values.
get
(URIish
the URI of the remote resource that needs authentication.
uri
,
List<CredentialItem>
the items the application requires to complete authentication.
items
)

Ask for the credential items to be populated.

public static CredentialsProvider

Returns:

the default credentials provider, or null.
getDefault
()

Get the default credentials provider, or null.

protected static boolean

Returns:

true if any of the passed items is null, false otherwise
isAnyNull
(CredentialItem...
credential items to check
items
)

Whether any of the passed items is null

public abstract boolean

Returns:

true if the provider is interactive with the end-user.
isInteractive
()

Check if the provider is interactive with the end-user.

public void
reset(URIish uri)

Reset the credentials provider for the given URI

public static void
setDefault(CredentialsProvider
the new default provider, may be null to select no default.
p
)

Set the default credentials provider.

public abstract boolean

Returns:

true if this org.eclipse.jgit.transport.CredentialsProvider supports all of the items supplied.
supports
(CredentialItem...
the items the application requires to complete authentication.
items
)

Check if the provider can supply the necessary org.eclipse.jgit.transport.CredentialItems.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

defaultProviderback to summary
private static volatile CredentialsProvider defaultProvider

Constructor Detail

CredentialsProviderback to summary
public CredentialsProvider()

Method Detail

getback to summary
public abstract boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem

Ask for the credential items to be populated.

Parameters
uri:URIish

the URI of the remote resource that needs authentication.

items:CredentialItem[]

the items the application requires to complete authentication.

Returns:boolean

true if the request was successful and values were supplied; false if the user canceled the request and did not supply all requested values.

Exceptions
UnsupportedCredentialItem:
if one of the items supplied is not supported.
getback to summary
public boolean get(URIish uri, List<CredentialItem> items) throws UnsupportedCredentialItem

Ask for the credential items to be populated.

Parameters
uri:URIish

the URI of the remote resource that needs authentication.

items:List<CredentialItem>

the items the application requires to complete authentication.

Returns:boolean

true if the request was successful and values were supplied; false if the user canceled the request and did not supply all requested values.

Exceptions
UnsupportedCredentialItem:
if one of the items supplied is not supported.
getDefaultback to summary
public static CredentialsProvider getDefault()

Get the default credentials provider, or null.

Returns:CredentialsProvider

the default credentials provider, or null.

isAnyNullback to summary
protected static boolean isAnyNull(CredentialItem... items)

Whether any of the passed items is null

Parameters
items:CredentialItem[]

credential items to check

Returns:boolean

true if any of the passed items is null, false otherwise

Since
4.2
isInteractiveback to summary
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:boolean

true if the provider is interactive with the end-user.

resetback to summary
public void reset(URIish uri)

Reset the credentials provider for the given URI

Parameters
uri:URIish

a org.eclipse.jgit.transport.URIish object.

setDefaultback to summary
public static void setDefault(CredentialsProvider p)

Set the default credentials provider.

Parameters
p:CredentialsProvider

the new default provider, may be null to select no default.

supportsback to summary
public abstract boolean supports(CredentialItem... items)

Check if the provider can supply the necessary org.eclipse.jgit.transport.CredentialItems.

Parameters
items:CredentialItem[]

the items the application requires to complete authentication.

Returns:boolean

true if this org.eclipse.jgit.transport.CredentialsProvider supports all of the items supplied.