Package org.omegat.core.team2.impl
Class GITCredentialsProvider
java.lang.Object
org.eclipse.jgit.transport.CredentialsProvider
org.omegat.core.team2.impl.GITCredentialsProvider
public class GITCredentialsProvider
extends org.eclipse.jgit.transport.CredentialsProvider
Git repository credentials provider. One credential provider created for all
git instances.
Git supports these protocols:
- file://
- ssh://
- git://
- https://
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanget(org.eclipse.jgit.transport.URIish uri, org.eclipse.jgit.transport.CredentialItem... items) Ask for the credential items to be populated.static voidinstall()Installation of credentials provider.booleanCheck if the provider is interactive with the end-user.voidreset(org.eclipse.jgit.transport.URIish uri) Reset connection.voidsetPredefinedCredentials(String url, String predefinedUser, String predefinedPass, String predefinedFingerprint) Set predefined git+ssh or https credentials.booleansupports(org.eclipse.jgit.transport.CredentialItem... items) Check if the credentials are supported.Methods inherited from class org.eclipse.jgit.transport.CredentialsProvider
get, getDefault, setDefault
-
Constructor Details
-
GITCredentialsProvider
public GITCredentialsProvider()
-
-
Method Details
-
install
public static void install()Installation of credentials provider.This static method installs GITCredentialsProvider object as default.
-
setPredefinedCredentials
public void setPredefinedCredentials(String url, String predefinedUser, String predefinedPass, String predefinedFingerprint) Set predefined git+ssh or https credentials.these credentials are automatically passed to ssh/https connection layer.
- Parameters:
url- target url.predefinedUser- predefined username.predefinedPass- predefined password.predefinedFingerprint- predefined fingerprint of host.
-
get
public boolean get(org.eclipse.jgit.transport.URIish uri, org.eclipse.jgit.transport.CredentialItem... items) throws org.eclipse.jgit.errors.UnsupportedCredentialItem Ask for the credential items to be populated.- Specified by:
getin classorg.eclipse.jgit.transport.CredentialsProvider- 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:
org.eclipse.jgit.errors.UnsupportedCredentialItem- if one of the items supplied is not supported.
-
isInteractive
public boolean isInteractive()Check if the provider is interactive with the end-user.GITCredentialsProvider is always interactive.
- Specified by:
isInteractivein classorg.eclipse.jgit.transport.CredentialsProvider- Returns:
- true
-
supports
public boolean supports(org.eclipse.jgit.transport.CredentialItem... items) Check if the credentials are supported.- Specified by:
supportsin classorg.eclipse.jgit.transport.CredentialsProvider- Parameters:
items- credential items- Returns:
- true when asked username and/or password. Otherwise, false.
-
reset
public void reset(org.eclipse.jgit.transport.URIish uri) Reset connection.It is called after 5 authorization failures. The transport gives up after 3 resets.
- Overrides:
resetin classorg.eclipse.jgit.transport.CredentialsProvider- Parameters:
uri- target URI.
-