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://
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    get(org.eclipse.jgit.transport.URIish uri, org.eclipse.jgit.transport.CredentialItem... items)
    Ask for the credential items to be populated.
    static void
    Installation of credentials provider.
    boolean
    Check if the provider is interactive with the end-user.
    void
    reset(org.eclipse.jgit.transport.URIish uri)
    Reset connection.
    void
    setPredefinedCredentials(String url, String predefinedUser, String predefinedPass, String predefinedFingerprint)
    Set predefined git+ssh or https credentials.
    boolean
    supports(org.eclipse.jgit.transport.CredentialItem... items)
    Check if the credentials are supported.

    Methods inherited from class org.eclipse.jgit.transport.CredentialsProvider

    get, getDefault, setDefault

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      get in class org.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:
      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:
      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:
      isInteractive in class org.eclipse.jgit.transport.CredentialsProvider
      Returns:
      true
    • supports

      public boolean supports(org.eclipse.jgit.transport.CredentialItem... items)
      Check if the credentials are supported.
      Specified by:
      supports in class org.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:
      reset in class org.eclipse.jgit.transport.CredentialsProvider
      Parameters:
      uri - target URI.