Question

Newbie here in SVNKit. I am having a hard time trying to figure out how to authenticate in my svn repository.

Basically, when I connect to my repository using command line SVN code, it tells me to accepts some certificate and request for my user name and password. It uses https also.

But using the code that I see from the wiki, it says something like this but this does not work readily.

ISVNAuthenticationManager authManager =
  SVNWCUtil.createDefaultAuthenticationManager(name, password);

I read somewhere regarding creating your own authentication provider but can't seem to find enough code that will tell me how this is done.

How can I authenticate to an svn repository using SSL and certificates?

Était-ce utile?

La solution

It depends on your purposes, you may create default auth manager:

ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager();

It uses settings from ~/.svn/ directory.

If you want auth manager to ask for passwords/keys from the console, have a look at SVNCommandEnvironment#createClientAuthenticationManager implementation.

But you also may create the simplest auth manager by just enumeration of credentials (no ~/.svn/ directory is required for this option):

ISVNAuthenticationManager authManager = new 
    BasicAuthenticationManager(new SVNAuthentication[] {authentication1, authentication2, ...});

so you just pass SVNSSLAuthentication instance (containing correct certificate file and passphrase) as one of array elements. SVNKit will try these authentications until success.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top