SVNKit Home

## org.tmatesoft.svn.core.auth
Class BasicAuthenticationManager

    java.lang.Object
      org.tmatesoft.svn.core.auth.BasicAuthenticationManager

All Implemented Interfaces:
  ISVNAuthenticationManager, ISVNProxyManager

public class BasicAuthenticationManager
extends Object
implements ISVNAuthenticationManager, ISVNProxyManager

The BasicAuthenticationManager is a simple implementation of ISVNAuthenticationManager for storing and providing credentials without using auth providers. A basic manager simply keeps the user credentials provided. Also this manager may store a single proxy server options context (for HHTP requests to go through a particular proxy server).

This manager does not use authentication providers (ISVNAuthenticationProvider) but only those credentials that was supplied to its constructor. Also this manager never caches credentials.

This manager is not used in SVNKit internals. You may use a default manager (how to get it read javadoc for `ISVNAuthenticationManager`), this basic manager or implement your own one.

Since:
  1.2
Version:
  1.3
Author:
  TMate Software Ltd.
See Also:
  `ISVNAuthenticationProvider`

Field Summary

Fields inherited from interface org.tmatesoft.svn.core.auth.ISVNAuthenticationManager
`PASSWORD, SSH, SSL, USERNAME`

Constructor Summary
`BasicAuthenticationManager(String userName, File keyFile, String passphrase, int portNumber)` Creates an auth manager given a user credential - a username and an ssh private key.
`BasicAuthenticationManager(String userName, String password)` Creates an auth manager given a user credential - a username and password.
`BasicAuthenticationManager(SVNAuthentication[] authentications)` Creates an auth manager given user credentials to use.

Method Summary
`void` `acknowledgeAuthentication(boolean accepted, String kind, String realm, SVNErrorMessage errorMessage, SVNAuthentication authentication)` Does nothing.
`void` `acknowledgeProxyContext(boolean accepted, SVNErrorMessage errorMessage)` Does nothing.
`void` `acknowledgeTrustManager(TrustManager manager)` Does nothing.
`int` `getConnectTimeout(SVNRepository repository)` Returns connection timeout value.
`SVNAuthentication` `getFirstAuthentication(String kind, String realm, SVNURL url)` Returns the first user's authentication credentials.
`SVNAuthentication` `getNextAuthentication(String kind, String realm, SVNURL url)` Returns next user authentication credentials.
`String` `getProxyHost()` Returns the proxy host name.
`ISVNProxyManager` `getProxyManager(SVNURL url)` Returns itself as a proxy manager.
`String` `getProxyPassword()` Returns the password to authenticate against the proxy server.
`int` `getProxyPort()` Returns the proxy port number.
`String` `getProxyUserName()` Returns the proxy user name.
`int` `getReadTimeout(SVNRepository repository)` Returns connection timeout value.
`TrustManager` `getTrustManager(SVNURL url)` Returns null.
`boolean` `isAuthenticationForced()` Tells whether authentication should be tried despite not being challenged from the server yet.
`void` `setAuthenticationForced(boolean forced)` Sets whether authentication should be forced or not.
`void` `setAuthenticationProvider(ISVNAuthenticationProvider provider)` Does nothing.
`void` `setAuthentications(SVNAuthentication[] authentications)` Sets the given user credentials to this manager.
`void` `setProxy(String proxyHost, int proxyPort, String proxyUserName, String proxyPassword)` Sets a proxy server context to this manager.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BasicAuthenticationManager

    public BasicAuthenticationManager(String userName,
                                      String password)

  Creates an auth manager given a user credential - a username and password.

Parameters:
  `userName` - a username
  `password` - a password

### BasicAuthenticationManager

    public BasicAuthenticationManager(String userName,
                                      File keyFile,
                                      String passphrase,
                                      int portNumber)

  Creates an auth manager given a user credential - a username and an ssh private key.

Parameters:
  `userName` - a username
  `keyFile` - a private key file
  `passphrase` - a password to the private key
  `portNumber` - a port number over which an ssh tunnel is established

### BasicAuthenticationManager

    public BasicAuthenticationManager(SVNAuthentication[] authentications)

  Creates an auth manager given user credentials to use.

Parameters:
  `authentications` - user credentials

Method Detail

### setAuthentications

    public void setAuthentications(SVNAuthentication[] authentications)

  Sets the given user credentials to this manager.

  Parameters:
    `authentications` - user credentials

### setProxy

    public void setProxy(String proxyHost,
                         int proxyPort,
                         String proxyUserName,
                         String proxyPassword)

  Sets a proxy server context to this manager.

  Parameters:
    `proxyHost` - a proxy server hostname
    `proxyPort` - a proxy server port
    `proxyUserName` - a username to supply to a proxy machine
    `proxyPassword` - a password to supply to a proxy machine

### getFirstAuthentication

    public SVNAuthentication getFirstAuthentication(String kind,
                                                    String realm,
                                                    SVNURL url)
                                             throws SVNException

  Returns the first user's authentication credentials.

  Specified by:
    `getFirstAuthentication` in interface `ISVNAuthenticationManager`
  Parameters:
    `kind` - credentials kind; valid kinds are `ISVNAuthenticationManager.SSH`, `ISVNAuthenticationManager.PASSWORD`, `ISVNAuthenticationManager.USERNAME`, `ISVNAuthenticationManager.SSL`, `ISVNAuthenticationManager.USERNAME`
    `realm` - authentication realm
    `url` - repository url
  Returns:
    first user's credentials
  Throws:
    `SVNException` - exception with `SVNErrorCode.RA_NOT_AUTHORIZED` error code - in case of invalid `kind`

### getNextAuthentication

    public SVNAuthentication getNextAuthentication(String kind,
                                                   String realm,
                                                   SVNURL url)
                                            throws SVNException

  Returns next user authentication credentials. This method is called whenever the first credentials returned by `getFirstAuthentication(String, String, SVNURL)` failed to authenticate the user.

  Specified by:
    `getNextAuthentication` in interface `ISVNAuthenticationManager`
  Parameters:
    `kind` - credentials kind; valid kinds are `ISVNAuthenticationManager.SSH`, `ISVNAuthenticationManager.PASSWORD`, `ISVNAuthenticationManager.USERNAME`, `ISVNAuthenticationManager.SSL`, `ISVNAuthenticationManager.USERNAME`
    `realm` - authentication realm
    `url` - repository url
  Returns:
    next user's authentication credentials
  Throws:
    `SVNException` - exception with `SVNErrorCode.RA_NOT_AUTHORIZED` error code - in case of invalid `kind`

### setAuthenticationProvider

    public void setAuthenticationProvider(ISVNAuthenticationProvider provider)

  Does nothing.

  Specified by:
    `setAuthenticationProvider` in interface `ISVNAuthenticationManager`
  Parameters:
    `provider` -

### getProxyManager

    public ISVNProxyManager getProxyManager(SVNURL url)
                                     throws SVNException

  Returns itself as a proxy manager.

  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 TrustManager getTrustManager(SVNURL url)
                                 throws SVNException

  Returns null.

  Specified by:
    `getTrustManager` in interface `ISVNAuthenticationManager`
  Parameters:
    `url` - repository url
  Returns:
    null
  Throws:
    `SVNException`
  Since:
    1.2.0

### acknowledgeAuthentication

    public void acknowledgeAuthentication(boolean accepted,
                                          String kind,
                                          String realm,
                                          SVNErrorMessage errorMessage,
                                          SVNAuthentication authentication)

  Does nothing.

  Specified by:
    `acknowledgeAuthentication` in interface `ISVNAuthenticationManager`
  Parameters:
    `accepted` -
    `kind` -
    `realm` -
    `errorMessage` -
    `authentication` -

### acknowledgeTrustManager

    public void acknowledgeTrustManager(TrustManager manager)

  Does nothing.

  Specified by:
    `acknowledgeTrustManager` in interface `ISVNAuthenticationManager`
  Parameters:
    `manager` -
  Since:
    1.2.0

### isAuthenticationForced

    public boolean isAuthenticationForced()

  Tells whether authentication should be tried despite not being challenged from the server yet.

  By default the return value is always false until this behavior is changed via a call to `setAuthenticationForced(boolean)`.

  Specified by:
    `isAuthenticationForced` in interface `ISVNAuthenticationManager`
  Returns:
    authentication force flag

### setAuthenticationForced

    public void setAuthenticationForced(boolean forced)

  Sets whether authentication should be forced or not.

  Parameters:
    `forced` - authentication force flag
  See Also:
    `isAuthenticationForced()`

### getProxyHost

    public String getProxyHost()

  Returns the proxy host name.

  Specified by:
    `getProxyHost` in interface `ISVNProxyManager`
  Returns:
    the proxy host argument value specified via the `setProxy(String, int, String, String)` method

### getProxyPort

    public int getProxyPort()

  Returns the proxy port number.

  Specified by:
    `getProxyPort` in interface `ISVNProxyManager`
  Returns:
    the proxy port argument value specified via the `setProxy(String, int, String, String)` method

### getProxyUserName

    public String getProxyUserName()

  Returns the proxy user name.

  Specified by:
    `getProxyUserName` in interface `ISVNProxyManager`
  Returns:
    the proxy user name argument value specified via the `setProxy(String, int, String, String)` method

### getProxyPassword

    public String getProxyPassword()

  Returns the password to authenticate against the proxy server.

  Specified by:
    `getProxyPassword` in interface `ISVNProxyManager`
  Returns:
    the proxy password argument value specified via the `setProxy(String, int, String, String)` method

### acknowledgeProxyContext

    public void acknowledgeProxyContext(boolean accepted,
                                        SVNErrorMessage errorMessage)

  Does nothing.

  Specified by:
    `acknowledgeProxyContext` in interface `ISVNProxyManager`
  Parameters:
    `accepted` -
    `errorMessage` -

### getReadTimeout

    public int getReadTimeout(SVNRepository repository)

  Returns connection timeout value.

  This implementation returns a read timeout value equal to 3600 seconds for `http` or `https` access operations. If `repository` uses a different access protocol, the return value will be 0.

  Specified by:
    `getReadTimeout` in interface `ISVNAuthenticationManager`
  Parameters:
    `repository` - repository access object
  Returns:
    read timeout value in milliseconds
  Since:
    1.2.0

### getConnectTimeout

    public int getConnectTimeout(SVNRepository repository)

  Returns connection timeout value.

  This implementation returns a connection timeout value equal to 60 seconds for `http` or `https` access operations. If `repository` uses a different access protocol, the return value will be 0.

  Specified by:
    `getConnectTimeout` in interface `ISVNAuthenticationManager`
  Parameters:
    `repository` - repository access object
  Returns:
    connection timeout value in milliseconds
  Since:
    1.2.0

SVNKit Home

Copyright © 2004-2009 TMate Software Ltd. All Rights Reserved.