Validation of user credentials

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Validation of user credentials

SteveV
I would like to be able to check that a user has access to a repository (ie has valid credentials) - before attempting to checkout/export/commit to the repository (ie if the user has provided incorrect id/password, the application can re-request them). In wiki.svnkit.com/Authentication under Forced Authentication, it suggests that this is possible however, I don't understand how to implement what it suggests (what flag?). My current operational code for creating authentication is: . . repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(cilRepos)); authManager = SVNWCUtil.createDefaultAuthenticationManager(user, passwd); repository.setAuthenticationManager(authManager); fileProperties = new SVNProperties(); baos = new ByteArrayOutputStream(); . . so after I've setup the 'repository' driver, I'd like to know that 'user' is 'authorised' to access the repository! Hope this makes sense to someone - thanks in anticipation of your help.
Reply | Threaded
Open this post in threaded view
|

Re: Validation of user credentials

Alexander Kitaev-4
Hello,

> I would like to be able to check that a user has access to a repository (ie
> has valid credentials) - before attempting to checkout/export/commit to the

If you'd like to test read access, then you may simply call
SVNRepository.testConnection() assuming you've set proper
ISVNAuthenticationManager on the SVNRepository instance (same you'd
use for checkout operation).

In case user do not have read access to repository, then
SVNAuthenticationException will be thrown by
SVNRepository.testConnection() method.


Alexander Kitaev,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!
http://hg4j.com/ - Java Mercurial Library!
http://sqljet.com/ - Java SQLite Library!



On 12 October 2011 07:31, SteveV <[hidden email]> wrote:

> I would like to be able to check that a user has access to a repository (ie
> has valid credentials) - before attempting to checkout/export/commit to the
> repository (ie if the user has provided incorrect id/password, the
> application can re-request them). In wiki.svnkit.com/Authentication under
> Forced Authentication, it suggests that this is possible however, I don't
> understand how to implement what it suggests (what flag?). My current
> operational code for creating authentication is: . . repository =
> SVNRepositoryFactory.create(SVNURL.parseURIEncoded(cilRepos)); authManager =
> SVNWCUtil.createDefaultAuthenticationManager(user, passwd);
> repository.setAuthenticationManager(authManager); fileProperties = new
> SVNProperties(); baos = new ByteArrayOutputStream(); . . so after I've setup
> the 'repository' driver, I'd like to know that 'user' is 'authorised' to
> access the repository! Hope this makes sense to someone - thanks in
> anticipation of your help.
> ________________________________
> View this message in context: Validation of user credentials
> Sent from the SVNKit - Users mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: Validation of user credentials

SteveV
Alexander,
Thanks for you speedy response. Your suggestion worked as required.
Cheers,


AlexanderKitaev wrote
Hello,

> I would like to be able to check that a user has access to a repository (ie
> has valid credentials) - before attempting to checkout/export/commit to the

If you'd like to test read access, then you may simply call
SVNRepository.testConnection() assuming you've set proper
ISVNAuthenticationManager on the SVNRepository instance (same you'd
use for checkout operation).

In case user do not have read access to repository, then
SVNAuthenticationException will be thrown by
SVNRepository.testConnection() method.


Alexander Kitaev,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!
http://hg4j.com/ - Java Mercurial Library!
http://sqljet.com/ - Java SQLite Library!



On 12 October 2011 07:31, SteveV <stephen.vardy@dsto.defence.gov.au> wrote:
> I would like to be able to check that a user has access to a repository (ie
> has valid credentials) - before attempting to checkout/export/commit to the
> repository (ie if the user has provided incorrect id/password, the
> application can re-request them). In wiki.svnkit.com/Authentication under
> Forced Authentication, it suggests that this is possible however, I don't
> understand how to implement what it suggests (what flag?). My current
> operational code for creating authentication is: . . repository =
> SVNRepositoryFactory.create(SVNURL.parseURIEncoded(cilRepos)); authManager =
> SVNWCUtil.createDefaultAuthenticationManager(user, passwd);
> repository.setAuthenticationManager(authManager); fileProperties = new
> SVNProperties(); baos = new ByteArrayOutputStream(); . . so after I've setup
> the 'repository' driver, I'd like to know that 'user' is 'authorised' to
> access the repository! Hope this makes sense to someone - thanks in
> anticipation of your help.
> ________________________________
> View this message in context: Validation of user credentials
> Sent from the SVNKit - Users mailing list archive at Nabble.com.
>