开发者

Tell SVNKit not to store credentials or at least change the path

开发者 https://www.devze.com 2023-02-22 19:40 出处:网络
Every time I connect to a repository the credentials are stored in the user\'s home folder under the .subversion directory (UNIX systems). Is there anyway not to do this, or at least specify another d

Every time I connect to a repository the credentials are stored in the user's home folder under the .subversion directory (UNIX systems). Is there anyway not to do this, or at least specify another directory something like --config-dir option under the command line?

I made a little hack that is change temporarily the开发者_JAVA技巧 user.home java property, but this doesn't work on Windows.

Thanks in advance,

Rui


One of the createDefaultAuthenticationManager() implementations allows this.

It is a static method in org.tmatesoft.svn.core.wc.SVNWCUtil.

Here is the description from https://svnkit.com/javadoc/

public static ISVNAuthenticationManager createDefaultAuthenticationManager(java.io.File configDir, java.lang.String userName, java.lang.String password, boolean storeAuth)

Creates a default authentication manager that uses the provided configuration directory and user's credentials. The storeAuth parameter affects on using the auth storage.

Parameters:
 configDir - a new location of the run-time configuration area
  userName - a user's name
  password - a user's password
  storeAuth - if true then the auth storage is enabled, otherwise disabled
 Returns:
  a default implementation of the credentials and servers configuration driver interface

So, you could do something like.

...set up repository...
File configDir = new File("MyFolder");
ISVNAuthenticationManager auth;
auth = SVNWCUtil.createDefaultAuthenticationManager( 
 configDir, user, password, false );
repository.setAuthenticationManager(auth);
0

精彩评论

暂无评论...
验证码 换一张
取 消