Re: Authentication problems with 1.5 api via perl.

2013-02-26 Thread Gavin Main
I didn't realise you were trying to post a review. Does post-review 
(bundled with RBTools) not help you? If not, why?


On Tuesday, 26 February 2013 16:45:43 UTC+8, cmuser wrote:

 Thanks. I  will try  follow it. 
 What i did is , tried writing the script(mentioned above) to post a review 
 request which is failing of xyz reason. So thought of using HTTP::Recorder 
 to get the script of posting a review request. But again facing issues in 
 that.

 curl command which worked once -
 curl   -k -H Basic YWRtaW46YWRtaW4= -X POST  -d {\repository_id\: 
 cvsrepo,\repository_path\::pserver:kapila:kapila123@svn:/opt/cvsroot,\username\:kapila,\password\:kapila123,\submit-as\:kapila}
   
 http://codereview.xyz.com/r/new

 Would be great if you can share your script to give quick  better 
 understanding.

 On Tuesday, February 26, 2013 2:08:54 PM UTC+5:30, Gavin Main wrote:

 After a bit of fiddling and research I found that the LWP and 
 HTTP::Cookies modules worked for me. Have a look at the documentation on 
 CPAN

 http://search.cpan.org/~gaas/HTTP-Cookies-6.01/lib/HTTP/Cookies.pm

 This link was also very helful:
 http://lwp.interglacial.com/ch11_01.htm


 Basically I wanted my post-commit hook to close out an associated review 
 on Reviewboard. So I wrote two subroutines to do that. The first generated 
 the cookie:
 - create the cookie file
 - issue the get request with HTTP::Request
 - authenticate with authorization_basic
 - extract the cookie
 - return hash

 Then I passed the cookie hash to another subroutine which issued my PUT 
 request with the information inside the cookie hash.

 Cheers,
 Gavin


 On Monday, 25 February 2013 21:25:13 UTC+8, cmuser wrote:

 i have tried to built like this,but still not working

 #!/usr/local/bin/perl

 use LWP::UserAgent;
 use MIME::Base64;

 $url=http://codereview.xyz.com/api/review-requests/;;
 $newurl=http://codereview.xyz.com/r/new/;;
 $user=admin;
 $pwd=admin;

 $text=$user:$pwd;
 $text = encode_base64($text);
 #print Encoded text: $text\n;
 %param =(
 repository_id =cvsrepo,
 repository_path =:pserver:user:pwd\@svn:/opt/cvsroot,
 username = admin,
 password = admin,
 submit-as = username,
 );
my $ua = LWP::UserAgent-new;
 $ua-timeout(TIMEOUT);
 $ua-protocols_allowed(['http', 'https']);
 $ua-default_header('Basic' = $text);
 $ua-credentials($newurl,$user,$pwd);

 $resp = $ua-get($url);
 print($resp-status_line(), \n);

 print(Add handler:\n);
 $ua-add_handler( response_header = sub { print HANDLER\n; }, 
 %param);
 print $ua-handlers('response_header', $resp).\n;
 push @{ $ua-requests_redirectable }, 'POST';
 print $ua-show_progress.\n;
 my $response = $ua-post($newurl,%param);

  if ($response-is_success) {
  print $response-decoded_content;
  }
  else {
  die $response-status_line;
  }




 On Friday, August 10, 2012 2:56:12 PM UTC+5:30, Gavin Main wrote:

 Hi Jeff, did you ever get this resolved? I am facing a similar issue.

 Christian, I am loving Reviewboard. Thank You!!!

 Cheers,
 Gav

 On Friday, 22 October 2010 02:06:16 UTC+8, Jeff wrote:

 I'm trying to write an svn pre-commit hook against a totally new 
 installation of reviewboard 1.5 (upgraded from the previous version, 
 but never really used). 

 As far as I can tell from the documentation, the json login page isn't 
 used anymore, and I just use basic HTTP authentication. 

 My perl code looks like this: 

 #!/usr/bin/perl 
 use LWP::UserAgent; 

 my $ua = LWP::UserAgent-new; 
 #$ua-credentials($rbhost:80,Web API,'user' = 'password'); 

 my $req = HTTP::Request-new(GET = http://reviewboard.local.com/ 
 rboard/api/review-requests/93/last-update/http://reviewboard.local.com/rboard/api/review-requests/93/last-update/);
  

 $req-authorization_basic('user', 'password'); 

 my $res = $ua-request($req); 
 print $res-as_string; 


 I've tried both the useragent credential and the request- 
 authorization_basic. 

 The result I get back is: 


 HTTP/1.1 401 UNAUTHORIZED 
 Cache-Control: max-age=0 
 Connection: close 
 Date: Thu, 21 Oct 2010 17:53:43 GMT 
 ETag: 3818aa0b0928af747aebc006814783fe 
 Server: Apache/2.2.3 (CentOS) 
 Vary: Cookie,Accept-Language 
 WWW-Authenticate: Basic realm=Web API 
 Content-Language: en-us 
 Content-Length: 70 
 Content-Type: application/json 
 Expires: Thu, 21 Oct 2010 17:53:43 GMT 
 Last-Modified: Thu, 21 Oct 2010 17:53:43 GMT 
 Client-Date: Thu, 21 Oct 2010 17:53:43 GMT 
 Client-Peer: 10.20.30.183:80 
 Client-Response-Num: 1 

 {stat: fail, err: {msg: You are not logged in, code: 103}} 



 If I try and hit the same page in an web browser after authenticating, 
 I get a 500 error and an email post at the end of this message. 

 What am I doing wrong? Is there any example perl code that hit's the 
 new API?  I assume the existing stuff that I'm finding on the net 
 won't work anymore. 


 Traceback (most recent call last): 

   File /usr/local/reviewboard/python

Re: There are only two Authentication method available.

2013-01-15 Thread Gavin Main
I am facing the same issue. I unfortunately don't have the luxury of using 
easy_install as this requires a direct connection to the interwebs 
(something we can't allow). I have packaged up every ReviewBoard 1.6.15 
dependency by hand. 'rb-site' upgrade hinted that I needed the following... 
Djblets (0.6.27), Django (1.3.4) and Feedparser (5.1.2), but when I start 
Reviewboard after successfully running 'rb-site upgrade /path/to/site', I 
lose my LDAP settings. 'DEBUG = True' doesn't give much away.

Any help would be greatly appreciated. Oh and while I'm here... we love 
ReviewBoard. 

Cheers!

On Wednesday, 10 October 2012 13:05:36 UTC+8, shravanthi s wrote:

 I am facing a similar issue. Actually I had successfully configured LDAP 
 and it was working fine (I am using version 1.6.5). However I had an issue 
 with uploading jpeg images so I uninstalled PIL and did some modifications 
 to setup.py (JPEG_ROOT = /usr/lib) and reinstalled PIL along with 
 libjpeg-devel. I was able to upload jpeg images.

  However a new issue popped up, my LDAP configuration was gone and when i 
 checked Authentication settings, there was no LDAP option at all! Only two 
 authentication methods were available. Not sure what went wrong. Would an 
 upgrade of Review Board resolve the issue? Appreciate your help..

 On Tuesday, 2 October 2012 02:15:14 UTC+5:30, Christian Hammond wrote:

 Running 'easy_install ReviewBoard' won't actually do much of anything. 
 You'd need to pass -U to do an upgrade.

 Christian

 -- 
 Christian Hammond - chi...@chipx86.com
 Review Board - http://www.reviewboard.org
 VMware, Inc. - http://www.vmware.com


 On Sat, Sep 29, 2012 at 12:32 AM, 周培青 zpq...@gmail.com wrote:

 Hi Christian,

 I remember I used easy_install and I tried running easy_install 
 ReviewBoard command again and got below information,
  easy_install ReviewBoard
 Searching for ReviewBoard
 Best match: ReviewBoard 1.6.11
 Processing ReviewBoard-1.6.11-py2.6.egg
 ReviewBoard 1.6.11 is already the active version in easy-install.pth
 Installing rb-site script to /usr/bin
 Installing rbssh script to /usr/bin

 Using /usr/lib/python2.6/site-packages/ReviewBoard-1.6.11-py2.6.egg
 Processing dependencies for ReviewBoard
 Finished processing dependencies for ReviewBoard

 Any ideas...

 在 2012年9月22日星期六UTC+8上午7时12分04秒,Christian Hammond写道:

 How did you install Review Board? It looks like the registrations are 
 missing, which indicates you may have used pip or something, instead of 
 easy_install.

 Christian

 -- 
 Christian Hammond - chi...@chipx86.com

 Review Board - http://www.reviewboard.org
 VMware, Inc. - http://www.vmware.com


 On Fri, Sep 21, 2012 at 1:37 AM, 周培青 zpq...@gmail.com wrote:

  Hi all,

 I installed ReviewBoard 1.6.11 on CentOS and I was trying to enable 
 LDAP as authentication method, but I cannot even select LDAP from the 
 Authentication Method dropdown in Authentication -- Authentication 
 Settings tab, see the attached screenshot.

 What's going on...

 I would be very appreciate for your help.

  -- 
 Want to help the Review Board project? Donate today at 
 http://www.reviewboard.org/**donate/http://www.reviewboard.org/donate/
 Happy user? Let us know at 
 http://www.reviewboard.org/**users/http://www.reviewboard.org/users/
 -~--~~~~--**~~--~--~---
 To unsubscribe from this group, send email to reviewboard...@**
 googlegroups.com

 For more options, visit this group at http://groups.google.com/**
 group/reviewboard?hl=enhttp://groups.google.com/group/reviewboard?hl=en


  -- 
 Want to help the Review Board project? Donate today at 
 http://www.reviewboard.org/donate/
 Happy user? Let us know at http://www.reviewboard.org/users/
 -~--~~~~--~~--~--~---
 To unsubscribe from this group, send email to 
 reviewboard...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/reviewboard?hl=en




-- 
Want to help the Review Board project? Donate today at 
http://www.reviewboard.org/donate/
Happy user? Let us know at http://www.reviewboard.org/users/
-~--~~~~--~~--~--~---
To unsubscribe from this group, send email to 
reviewboard+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/reviewboard?hl=en