Class DefaultSVNAuthenticationManager

java.lang.Object
org.tmatesoft.svn.core.internal.wc.DefaultSVNAuthenticationManager
All Implemented Interfaces:
ISVNAuthenticationManager, ISVNSSHHostVerifier, ISVNSSLPasspharsePromptSupport

public class DefaultSVNAuthenticationManager extends java.lang.Object implements ISVNAuthenticationManager, ISVNSSLPasspharsePromptSupport, ISVNSSHHostVerifier
Version:
1.3
  • Field Details

    • myIsStoreAuth

      private boolean myIsStoreAuth
    • myConfigDirectory

      private java.io.File myConfigDirectory
    • myAuthOptions

      private ISVNAuthenticationStorageOptions myAuthOptions
    • myDefaultOptions

      private DefaultSVNOptions myDefaultOptions
    • myHostOptionsProvider

      private ISVNHostOptionsProvider myHostOptionsProvider
    • myRuntimeAuthStorage

      private ISVNAuthenticationStorage myRuntimeAuthStorage
    • myProviders

      private ISVNAuthenticationProvider[] myProviders
    • myPreviousAuthentication

      private SVNAuthentication myPreviousAuthentication
    • myPreviousErrorMessage

      private SVNErrorMessage myPreviousErrorMessage
    • myLastProviderIndex

      private int myLastProviderIndex
    • myLastLoadedAuth

      private SVNAuthentication myLastLoadedAuth
    • myIsAuthenticationForced

      private boolean myIsAuthenticationForced
    • myIsAutoDismissSensitiveData

      private boolean myIsAutoDismissSensitiveData
  • Constructor Details

  • Method Details

    • setInMemoryServersOptions

      public void setInMemoryServersOptions(java.util.Map serversOptions)
    • setInMemoryConfigOptions

      public void setInMemoryConfigOptions(java.util.Map configOptions)
    • getAuthenticationStorageOptions

      public ISVNAuthenticationStorageOptions getAuthenticationStorageOptions()
    • setAuthenticationStorageOptions

      public void setAuthenticationStorageOptions(ISVNAuthenticationStorageOptions authOptions)
    • setAuthenticationProvider

      public void setAuthenticationProvider(ISVNAuthenticationProvider provider)
      Description copied from interface: ISVNAuthenticationManager
      Sets a custom authentication provider that will provide user credentials for authentication.
      Specified by:
      setAuthenticationProvider in interface ISVNAuthenticationManager
      Parameters:
      provider - an authentication provider
    • getConfigDirectory

      protected java.io.File getConfigDirectory()
    • getDefaultOptions

      public DefaultSVNOptions getDefaultOptions()
    • getHostOptionsProvider

      public ISVNHostOptionsProvider getHostOptionsProvider()
    • setHostOptionsProvider

      protected void setHostOptionsProvider(ISVNHostOptionsProvider hostOptionsProvider)
    • getAuthTypes

      public java.util.Collection<java.lang.String> getAuthTypes(SVNURL url)
    • getProxyManager

      public ISVNProxyManager getProxyManager(SVNURL url) throws SVNException
      Description copied from interface: ISVNAuthenticationManager
      Returns a proxy manager that keeps settings for that proxy server over which HTTP requests are send to a repository server.

      A default auth manager uses proxy settings from the standard servers file.

      Specified by:
      getProxyManager in interface ISVNAuthenticationManager
      Parameters:
      url - a repository location that will be accessed over the proxy server for which a manager is needed
      Returns:
      a proxy manager
      Throws:
      SVNException
    • getTrustManager

      public javax.net.ssl.TrustManager getTrustManager(SVNURL url) throws SVNException
      Description copied from interface: ISVNAuthenticationManager
      Returns a manager which handles trust data for the specified url.

      Note: in pre-1.2.0 versions ISVNAuthenticationManager used to provide ISVNSSLManager via a method getSSLManager() which is now replaced by this one. ISVNSSLManager is no longer used (replaced by TrustManager).

      Specified by:
      getTrustManager in interface ISVNAuthenticationManager
      Parameters:
      url - repository url
      Returns:
      trust manager
      Throws:
      SVNException
    • getFirstAuthentication

      public SVNAuthentication getFirstAuthentication(java.lang.String kind, java.lang.String realm, SVNURL url) throws SVNException
      Description copied from interface: ISVNAuthenticationManager
      Retrieves the first user credential. The scheme of retrieving credentials:
      • For the first try to authenticate a user to a repository (using the specifed realm) an SVNRepository driver calls getFirstAuthentication() and sends the retrieved credential.
      • If the credential is accepted, it may be stored. If not, the driver calls getNextAuthentication() and sends the next credential.
      • If the last credential was not accepted, the driver still tries to get the next credential for the same realm.

      For each credential kind an implementor should return a kind-specific credential. The following table matches kinds to proper credential classes:

      Credential Kind Credential Class
      ISVNAuthenticationManager.PASSWORDSVNPasswordAuthentication
      ISVNAuthenticationManager.SSHSVNSSHAuthentication
      ISVNAuthenticationManager.SSLSVNSSLAuthentication
      ISVNAuthenticationManager.USERNAMESVNUserNameAuthentication
      Specified by:
      getFirstAuthentication in interface ISVNAuthenticationManager
      Parameters:
      kind - a credential kind
      realm - a repository authentication realm
      url - a repository location that is to be accessed
      Returns:
      the first try user credential
      Throws:
      SVNException
    • getNextAuthentication

      public SVNAuthentication getNextAuthentication(java.lang.String kind, java.lang.String realm, SVNURL url) throws SVNException
      Description copied from interface: ISVNAuthenticationManager
      Retrieves the next user credential if the first try failed. The scheme of retrieving credentials:
      • For the first try to authenticate a user to a repository (using the specifed realm) an SVNRepository driver calls getFirstAuthentication() and sends the retrieved credential.
      • If the credential is accepted, it may be stored. If not, the driver calls getNextAuthentication() and sends the next credential.
      • If the last credential was not accepted, the driver still tries to get the next credential for the same realm.

      For each credential kind an implementor should return a kind-specific credential. The following table matches kinds to proper credential classes:

      Credential Kind Credential Class
      ISVNAuthenticationManager.PASSWORDSVNPasswordAuthentication
      ISVNAuthenticationManager.SSHSVNSSHAuthentication
      ISVNAuthenticationManager.SSLSVNSSLAuthentication
      ISVNAuthenticationManager.USERNAMESVNUserNameAuthentication
      Specified by:
      getNextAuthentication in interface ISVNAuthenticationManager
      Parameters:
      kind - a credential kind
      realm - a repository authentication realm
      url - a repository location that is to be accessed
      Returns:
      the next try user credential
      Throws:
      SVNException
    • setDismissSensitiveDataUponUse

      public void setDismissSensitiveDataUponUse(boolean dismiss)
      Control whether to dismiss credentials sensitive data once credentials object has been used. Default is not to dismiss.
      Parameters:
      dismiss - whether to dismiss data.
      Since:
      1.8.9
    • isDismissSensitiveDataUponUse

      public boolean isDismissSensitiveDataUponUse()
      Returns whether this authenticaiton manager dismiss sensitive data once credentials object has been used. Default is not to dismiss.
      Returns:
      Since:
      1.8.9
    • acknowledgeAuthentication

      public void acknowledgeAuthentication(boolean accepted, java.lang.String kind, java.lang.String realm, SVNErrorMessage errorMessage, SVNAuthentication authentication) throws SVNException
      Description copied from interface: ISVNAuthenticationManager
      Accepts the given authentication if it was successfully accepted by a repository server, or not if authentication failed. As a result the provided credential may be cached (authentication succeeded) or deleted from the cache (authentication failed).
      Specified by:
      acknowledgeAuthentication in interface ISVNAuthenticationManager
      Parameters:
      accepted - true if the credential was accepted by the server, otherwise false
      kind - a credential kind (ISVNAuthenticationManager.PASSWORD or ISVNAuthenticationManager.SSH or ISVNAuthenticationManager.USERNAME)
      realm - a repository authentication realm
      errorMessage - the reason of the authentication failure
      authentication - a user credential to accept/drop
      Throws:
      SVNException
    • acknowledgeTrustManager

      public void acknowledgeTrustManager(javax.net.ssl.TrustManager manager)
      Description copied from interface: ISVNAuthenticationManager
      Acknowledges the specified trust manager. This method is called only when a secure connection is successfully established with the specified manager.
      Specified by:
      acknowledgeTrustManager in interface ISVNAuthenticationManager
      Parameters:
      manager - trust manager to acknowledge (one returned by ISVNAuthenticationManager.getTrustManager(SVNURL))
    • hasExplicitCredentials

      private boolean hasExplicitCredentials(java.lang.String kind)
    • setRuntimeStorage

      public void setRuntimeStorage(ISVNAuthenticationStorage storage)
      Sets a specific runtime authentication storage manager. This storage manager will be asked by this auth manager for cached credentials as well as used to cache new ones accepted recently.
      Parameters:
      storage - a custom auth storage manager
    • getRuntimeAuthStorage

      protected ISVNAuthenticationStorage getRuntimeAuthStorage()
    • getAuthenticationProvider

      protected ISVNAuthenticationProvider getAuthenticationProvider()
    • getDefaultSSHAuthentication

      protected SVNSSHAuthentication getDefaultSSHAuthentication(SVNURL url)
    • createDefaultAuthenticationProvider

      protected ISVNAuthenticationProvider createDefaultAuthenticationProvider(java.lang.String userName, char[] password, java.io.File privateKey, char[] passphrase, boolean allowSave)
    • createRuntimeAuthenticationProvider

      protected ISVNAuthenticationProvider createRuntimeAuthenticationProvider()
    • createCacheAuthenticationProvider

      protected ISVNAuthenticationProvider createCacheAuthenticationProvider(java.io.File authDir, java.lang.String userName)
    • createAuthenticationStorageOptions

      public ISVNAuthenticationStorageOptions createAuthenticationStorageOptions()
    • isAuthenticationForced

      public boolean isAuthenticationForced()
      Description copied from interface: ISVNAuthenticationManager
      Checks whether client should send authentication credentials to a repository server not waiting for the server's challenge.

      In some cases it may be necessary to send credentials beforehand, not waiting until the server asks to do it itself. To achieve such behaviour an implementor should return true from this routine.

      Specified by:
      isAuthenticationForced in interface ISVNAuthenticationManager
      Returns:
      true if authentication credentials are forced to be sent;false when credentials are to be sent only in response to a server challenge
    • setAuthenticationForced

      public void setAuthenticationForced(boolean forced)
      Specifies the way how credentials are to be supplied to a repository server.
      Parameters:
      forced - true to force credentials sending; false to put off sending credentials till a server challenge
      See Also:
    • getReadTimeout

      public int getReadTimeout(SVNRepository repository)
      Description copied from interface: ISVNAuthenticationManager
      Returns the read timeout value in milliseconds which repository should use in socket read operations. Socket read operations will block only for this amount of time.
      Specified by:
      getReadTimeout in interface ISVNAuthenticationManager
      Parameters:
      repository - a repository access driver
      Returns:
      connection timeout value
    • getConnectTimeout

      public int getConnectTimeout(SVNRepository repository)
      Description copied from interface: ISVNAuthenticationManager
      Returns the connection timeout value in milliseconds which repository should use in network connection operations.
      Specified by:
      getConnectTimeout in interface ISVNAuthenticationManager
      Parameters:
      repository - repository access object
      Returns:
      connection timeout value in milliseconds which will be set to a socket
    • verifyHostKey

      public void verifyHostKey(java.lang.String hostName, int port, java.lang.String keyAlgorithm, byte[] hostKey) throws SVNException
      Specified by:
      verifyHostKey in interface ISVNSSHHostVerifier
      Throws:
      SVNException
    • equals

      private static boolean equals(byte[] b1, byte[] b2)
    • dismissSensitiveData

      public void dismissSensitiveData()
      Dismiss cached sensitive data (e.g. password) Calling this method clears explicit and cached credentials stored in this authentication manager.
      Since:
      1.8.9
    • isSSLPassphrasePromtSupported

      public boolean isSSLPassphrasePromtSupported()
      Specified by:
      isSSLPassphrasePromtSupported in interface ISVNSSLPasspharsePromptSupport