Option to fold extention keys/vals into user object.
Ashley Pond V [Sat, 16 Oct 2010 02:03:38 +0000 (02:03 +0000)]
Changes
lib/Catalyst/Authentication/Credential/OpenID.pm

diff --git a/Changes b/Changes
index 2c5c40d..965944b 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,11 @@
 Revision history for Catalyst::Authentication::Credential::OpenID
 
-0.16_01  Tue Apr  6 19:50:55 PDT 2010
+0.16_02 Fri Oct 15 18:54:24 PDT 2010
+      - Experimental, undocumented flatten_extensions_into_user added
+        which flattens the namespaced key vals from extensions into
+        the user object.
+
+0.16_01 Tue Apr  6 19:50:55 PDT 2010
       - extension_args are no longer honored as deprecated synonym for
         extensions.
       - extensions is now a hash ref which facilitates multiple
index 80c7ec7..fa60a9e 100644 (file)
@@ -13,9 +13,10 @@ __PACKAGE__->mk_accessors(qw/
     errors_are_fatal
     extensions
     trust_root
+    flatten_extensions_into_user
 /);
 
-our $VERSION = "0.16_01";
+our $VERSION = "0.16_02";
 
 use Net::OpenID::Consumer;
 use Catalyst::Exception ();
@@ -130,10 +131,14 @@ sub authenticate {
             my $user = +{ map { $_ => scalar $identity->$_ }
                 qw( url display rss atom foaf declared_rss declared_atom declared_foaf foafmaker ) };
             # Dude, I did not design the array as hash spec. Don't curse me [apv].
-
             for my $key ( keys %extensions )
             {
-                $user->{extensions}->{$key} = $identity->signed_extension_fields($key);
+                my $vals = $identity->signed_extension_fields($key);
+                $user->{extensions}->{$key} = $vals;
+                if ( $self->flatten_extensions_into_user )
+                {
+                    $user->{$_} = $vals->{$_} for keys %{$vals};
+                }
             }
 
             my $user_obj = $realm->find_user($user, $c);