[Jifty-commit] r4398 - in jifty/trunk: lib/Jifty/Plugin/OAuth
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Nov 9 13:31:55 EST 2007
Author: sartak
Date: Fri Nov 9 13:31:54 2007
New Revision: 4398
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Plugin/OAuth/Dispatcher.pm
Log:
r44786 at onn: sartak | 2007-11-07 15:37:39 -0500
Various improvements of try_oauth so it gets further (but not all the way) in the correct codepath
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 Fri Nov 9 13:31:54 2007
@@ -210,14 +210,18 @@
set no_abort => 1;
my %oauth_params = get_parameters(@params);
for (@params) {
- return if !defined($oauth_params{$_});
+ abortmsg(undef, "Undefined required parameter: $_"), return if !defined($oauth_params{$_});
}
my $consumer = get_consumer($oauth_params{consumer_key});
return if !$consumer->id;
+ abortmsg(undef, "No known consumer with key $oauth_params{consumer_key}"), return unless $consumer->id;
my $signature_key = get_signature_key($oauth_params{signature_method}, $consumer);
- return if !$signature_key;
+ if ($signature_key && ref($signature_key) && !defined($$signature_key)) {
+ abortmsg(undef, "Failed to get signature key.");
+ return;
+ }
my ($ok, $msg) = $consumer->is_valid_request(@oauth_params{qw/timestamp nonce/});
abortmsg(undef, $msg), return if !$ok;
@@ -270,10 +274,14 @@
method is unsupported, or if the consumer lacks the prerequisites for this
signature method.
-Will return C<undef> is the signature key is consumer independent, as is the
+Will return C<undef> if the signature key is consumer independent, as is the
case for C<PLAINTEXT> and C<HMAC-SHA1>. C<RSA-SHA1> depends on the consumer
having the C<rsa_key> field.
+If the signature method is invalid and no_abort is set, it will return a
+special value of a reference to undef. Yes this sucks but undef already has
+an important meaning.
+
=cut
{
@@ -286,7 +294,7 @@
if (!$valid_signature_methods{$method}) {
abortmsg(400, "Unsupported signature method requested: $method")
unless get 'no_abort';
- return;
+ return \undef;
}
my $field = $key_field{$method};
More information about the Jifty-commit
mailing list