You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Jeremy Brown <je...@cadre5.com> on 2004/03/17 20:36:37 UTC

Question about SWIG Perl Bindings

Hello all,

I see in the man page for SVN::Client that the following code allows you 
to use a callback to prompt the user for information used to 
authenticate before access to the Subversion repository:


           use SVN::Client;
           my $ctx = new SVN::Client(
                     auth => [SVN::Client::get_simple_provider(),
                     
SVN::Client::get_simple_prompt_provider(\&simple_prompt,2),
                     SVN::Client::get_username_provider()]
                     );

           $ctx->cat (\*STDOUT, 
"http://svn.collab.net/repos/svn/trunk/README",
                      "HEAD");

           sub simple_prompt {
             my $cred = shift;
             my $realm = shift;
             my $default_username = shift;
             my $may_save = shift;
             my $pool = shift;

             print "Enter authentication info for realm: $realm\n";
             print "Username: ";
             my $username = <>;
             chop($username);
             $cred->username($username);
             print "Password: ";
             my $password = <>;
             chomp($password);
             $cred->password($password);


In the particular piece of software I'm working on, users will already 
have been authenticated at this point (we use an external LDAP server), 
and I simply want to create a Subversion client that performs operations 
on the remote repository as though it were that user.  Is there a simple 
way I can just instantiate a SVN::Client object and simply pass it the 
username it needs to operate as?  Or will I need to write some sort of 
weird callback routine, that I seed with the correct username ahead of 
time, before calling SVN::Client->New?

Thanks in advance,

Jeremy

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org