|
The only pure Java Subversion library in the world!
|
|
Authentication
To provide user's authentication information to a repository server
SVNRepository drivers use the ISVNAuthenticationManager (org.tmatesoft.svn.core.auth)
interface.
When directly using an SVNRepository object you should
provide an authentication manager in the following way:
...
import org.tmatesoft.svn.core.io.SVNRepository;
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
...
SVNRepository repository;
ISVNAuthenticationManager authManager;
...
repository.setAuthenticationManager(authManager);
If managing Working Copies (i.e. using SVN*Client classes):
...
import org.tmatesoft.svn.core.wc.SVNUpdateClient;
import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager;
import org.tmatesoft.svn.core.wc.ISVNOptions;
...
ISVNAuthenticationManager authManager;
ISVNOptions options;
...
SVNUpdateClient updateClient = new SVNUpdateClient(authManager, options);
or if using a single SVNClientManager :
...
import org.tmatesoft.svn.core.wc.SVNClientManager;
...
SVNClientManager manager =
SVNClientManager.newInstance(options, authManager);
You may implement your own authentication manager and thus make JavaSVN
use it during runtime.
ISVNAuthenticationProvider and ISVNAuthenticationStorage
As a matter of fact, for providing client's credentials and accepting server's
authentication certificates ISVNAuthenticationManager may use the
ISVNAuthenticationProvider interface. To make an authentication
manager use your auth provider implementation simply pass it to the manager like this:
import org.tmatesoft.svn.core.auth.ISVNAuthenticationProvider;
ISVNAuthenticationProvider yourAuthProvider;
ISVNAuthenticationManager authManager;
...
authManager.setAuthenticationProvider(yourAuthProvider);
Also ISVNAuthenticationManager may be configured with a run-time authentication
storage that can be used for credentials caching during runtime:
import org.tmatesoft.svn.core.auth.ISVNAuthenticationStorage;
ISVNAuthenticationStorage yourAuthStorage;
ISVNAuthenticationManager authManager;
...
authManager.setAuthenticationProvider(yourAuthStorage);
Using a default implementation
To get a default implementation of ISVNAuthenticationManager you should
use createDefaultAuthenticationManager() methods of the SVNWCUtil
class (org.tmatesoft.svn.core.wc). Read the javadoc
for this class.
In addition to an authentication provider the default implementation - DefaultSVNAuthenticationManager (org.tmatesoft.svn.core.internal.wc) -
also uses settings and credentials cache from either the default Subversion run-time configuration directory or
from the config directory that was provided to an appropriate createDefaultAuthenticationManager() method.
If you have any questions regarding JavaSVN, would like to report a bug or contribute a patch, please write to
support@tmatesoft.com
|