Package org.eclipse.jgit.transport

## Class CredentialsProvider

- java.lang.Object
- - org.eclipse.jgit.transport.CredentialsProvider

Direct Known Subclasses:
  `ChainingCredentialsProvider`, `NetRCCredentialsProvider`, `UsernamePasswordCredentialsProvider`

    public abstract class CredentialsProvider
    extends Object

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:
  `UsernamePasswordCredentialsProvider`

### Constructor Summary

Constructors
`CredentialsProvider()`

### Method Summary

All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
`boolean` `get​(URIish uri, List<CredentialItem> items)` Ask for the credential items to be populated.
`abstract boolean` `get​(URIish uri, CredentialItem... items)` Ask for the credential items to be populated.
`static CredentialsProvider` `getDefault()`
`abstract boolean` `isInteractive()` Check if the provider is interactive with the end-user.
`void` `reset​(URIish uri)` Reset the credentials provider for the given URI
`static void` `setDefault​(CredentialsProvider p)` Set the default credentials provider.
`abstract boolean` `supports​(CredentialItem... items)` Check if the provider can supply the necessary `CredentialItem`s.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### CredentialsProvider

    public CredentialsProvider()

### Method Detail

#### getDefault

    public static CredentialsProvider getDefault()

Returns:
  the default credentials provider, or null.

#### setDefault

    public static void setDefault​(CredentialsProvider p)

Set the default credentials provider.

Parameters:
  `p` - the new default provider, may be null to select no default.

#### 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:
  `true` if the provider is interactive with the end-user.

#### supports

    public abstract boolean supports​(CredentialItem... items)

Check if the provider can supply the necessary `CredentialItem`s.

Parameters:
  `items` - the items the application requires to complete authentication.
Returns:
  `true` if this `CredentialsProvider` supports all of the items supplied.

#### get

    public abstract boolean get​(URIish uri,
                                CredentialItem... items)
                         throws UnsupportedCredentialItem

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:
  `true` if the request was successful and values were supplied; `false` if the user canceled the request and did not supply all requested values.
Throws:
  `UnsupportedCredentialItem` - if one of the items supplied is not supported.

#### get

    public boolean get​(URIish uri,
                       List<CredentialItem> items)
                throws UnsupportedCredentialItem

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:
  `true` if the request was successful and values were supplied; `false` if the user canceled the request and did not supply all requested values.
Throws:
  `UnsupportedCredentialItem` - if one of the items supplied is not supported.

#### reset

    public void reset​(URIish uri)

Reset the credentials provider for the given URI

Parameters:
  `uri` -