[Jifty-commit] r5093 - in jifty/trunk: lib/Jifty/Plugin/OAuth lib/Jifty/Plugin/OAuth/Model t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth

Jifty commits jifty-commit at lists.jifty.org
Mon Feb 11 15:02:10 EST 2008


Author: sartak
Date: Mon Feb 11 15:01:57 2008
New Revision: 5093

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm
   jifty/trunk/lib/Jifty/Plugin/OAuth/Model/Consumer.pm
   jifty/trunk/t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm

Log:
 r51757 at onn:  sartak | 2008-02-11 14:59:50 -0500
 OAuth: Better debugging output, small fixes


Modified: jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm	Mon Feb 11 15:01:57 2008
@@ -27,8 +27,13 @@
 
 sub abortmsg {
     my ($code, $msg) = @_;
-    Jifty->log->debug($msg) if defined($msg);
-    abort($code) if $code;
+    if ($code) {
+        Jifty->log->debug("$code for ".Jifty->web->request->path.":" . $msg) if defined($msg);
+        abort($code);
+    }
+    elsif (defined $msg) {
+        Jifty->log->debug("OAuth denied for ".Jifty->web->request->path.":" . $msg);
+    }
 }
 
 =head2 request_token

Modified: jifty/trunk/lib/Jifty/Plugin/OAuth/Model/Consumer.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/OAuth/Model/Consumer.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/OAuth/Model/Consumer.pm	Mon Feb 11 15:01:57 2008
@@ -94,13 +94,13 @@
 
 sub is_valid_request {
     my ($self, $timestamp, $nonce) = @_;
-    return (0, "Timestamp nonincreasing.")
+    return (0, "Timestamp nonincreasing, $timestamp < ".$self->last_timestamp.".")
         if $timestamp < $self->last_timestamp;
     return 1 if $timestamp > $self->last_timestamp;
 
     # if this is the same timestamp as the last, we must check that the nonce
     # is unique across the requests of these timestamps
-    return (0, "Already used this nonce.")
+    return (0, "Already used the nonce $nonce.")
         if defined $self->nonces->{$nonce};
 
     return 1;

Modified: jifty/trunk/t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm
==============================================================================
--- jifty/trunk/t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm	(original)
+++ jifty/trunk/t/TestApp-Plugin-OAuth/lib/TestApp/Plugin/OAuth/Test.pm	Mon Feb 11 15:01:57 2008
@@ -225,7 +225,7 @@
     local $Test::Builder::Level = $Test::Builder::Level + 1;
 
     my $error = _authorize_request_token('Allow');
-    ok(0, $error), return if $error;
+    ::fail($error), return if $error;
 
     my $name = $token_obj->consumer->name;
     $umech->content_contains("Allowing $name to access your stuff");
@@ -235,7 +235,7 @@
     local $Test::Builder::Level = $Test::Builder::Level + 1;
 
     my $error = _authorize_request_token('Deny');
-    ok(0, $error), return if $error;
+    ::fail($error), return if $error;
 
     my $name = $token_obj->consumer->name;
     $umech->content_contains("Denying $name the right to access your stuff");


More information about the Jifty-commit mailing list