[Catalyst-commits] r8684 - in Catalyst-Authentication-Credential-OpenID: . 0.12 0.12/lib/Catalyst/Authentication/Credential 0.12/t/TestApp/lib

apv at dev.catalyst.perl.org apv at dev.catalyst.perl.org
Tue Dec 2 03:27:49 GMT 2008


Author: apv
Date: 2008-12-02 03:27:49 +0000 (Tue, 02 Dec 2008)
New Revision: 8684

Added:
   Catalyst-Authentication-Credential-OpenID/0.12/
Modified:
   Catalyst-Authentication-Credential-OpenID/0.12/Changes
   Catalyst-Authentication-Credential-OpenID/0.12/lib/Catalyst/Authentication/Credential/OpenID.pm
   Catalyst-Authentication-Credential-OpenID/0.12/t/TestApp/lib/TestApp.pm
Log:
This is 0.12 on the CPAN.


Copied: Catalyst-Authentication-Credential-OpenID/0.12 (from rev 8511, Catalyst-Authentication-Credential-OpenID/0.11)

Modified: Catalyst-Authentication-Credential-OpenID/0.12/Changes
===================================================================
--- Catalyst-Authentication-Credential-OpenID/0.11/Changes	2008-10-06 18:54:31 UTC (rev 8511)
+++ Catalyst-Authentication-Credential-OpenID/0.12/Changes	2008-12-02 03:27:49 UTC (rev 8684)
@@ -1,5 +1,13 @@
 Revision history for Catalyst::Authentication::Credential::OpenID
 
+0.12  
+      - Everything is finally passing tests so I put most of the
+        previous versions on the backpan because they're nearly
+        identical except for Makefile changes.
+      - Applied patches from Menno Blom to allow simple registration
+        to work. Considered experimental for now, I think. Not because
+        it won't stay but because it might not work as expected.
+
 0.11  Sun Oct  5 00:41:37 PDT 2008
       - Added LWPx paranoid to build_requires.
       - Put some experimental mdash entities into the Pod.

Modified: Catalyst-Authentication-Credential-OpenID/0.12/lib/Catalyst/Authentication/Credential/OpenID.pm
===================================================================
--- Catalyst-Authentication-Credential-OpenID/0.11/lib/Catalyst/Authentication/Credential/OpenID.pm	2008-10-06 18:54:31 UTC (rev 8511)
+++ Catalyst-Authentication-Credential-OpenID/0.12/lib/Catalyst/Authentication/Credential/OpenID.pm	2008-12-02 03:27:49 UTC (rev 8684)
@@ -1,14 +1,13 @@
 package Catalyst::Authentication::Credential::OpenID;
 use strict;
-use warnings;
-no warnings "uninitialized";
+use warnings; no warnings "uninitialized"; # 321
 use parent "Class::Accessor::Fast";
 
 BEGIN {
     __PACKAGE__->mk_accessors(qw/ _config realm debug secret /);
 }
 
-our $VERSION = "0.11";
+our $VERSION = "0.12";
 
 use Net::OpenID::Consumer;
 use Catalyst::Exception ();
@@ -33,7 +32,7 @@
                                                             );
 
     $secret = substr($secret,0,255) if length $secret > 255;
-    $self->secret( $secret );
+    $self->secret($secret);
     $self->_config->{ua_class} ||= "LWPx::ParanoidAgent";
 
     my $agent_class = $self->_config->{ua_class};
@@ -72,6 +71,9 @@
         my $identity = $csr->claimed_identity($claimed_uri)
             or Catalyst::Exception->throw($csr->err);
 
+        $identity->set_extension_args(@{$self->_config->{extension_args}})
+            if $self->_config->{extension_args};
+
         my $check_url = $identity->check_url(
             return_to  => $current . '?openid-check=1',
             trust_root => $current,
@@ -96,6 +98,10 @@
             # This is where we ought to build an OpenID user and verify against the spec.
             my $user = +{ map { $_ => scalar $identity->$_ }
                 qw( url display rss atom foaf declared_rss declared_atom declared_foaf foafmaker ) };
+            
+            for(keys %{$self->{_config}->{extensions}}) {
+                $user->{extensions}->{$_} = $identity->signed_extension_fields($_);
+            }
 
             my $user_obj = $realm->find_user($user, $c);
 
@@ -216,7 +222,7 @@
 See L<Catalyst::Plugin::Authentication::Internals> for more about this
 implementation.
 
-=head1 METHOD
+=head1 METHODS
 
 =over 4
 
@@ -319,10 +325,17 @@
                           class => "OpenID",
                       },
                   },
+                  extension_args => [
+                      'http://openid.net/extensions/sreg/1.1',
+                      {
+                       required => 'email',
+                       optional => 'fullname,nickname,timezone',
+                      },
+                  ],
               },
           },
-      },
-      );
+      }
+    );
 
 This is the same configuration in the default L<Catalyst> configuration format from L<Config::General>.
 
@@ -358,6 +371,11 @@
                  </store>
                  class   OpenID
              </credential>
+             <extension_args>
+                 http://openid.net/extensions/sreg/1.1
+                 required   email
+                 optional   fullname,nickname,timezone
+             </extension_args>
          </openid>
      </realms>
  </Plugin::Authentication>
@@ -389,9 +407,17 @@
          whitelisted_hosts:
            - 127.0.0.1
            - localhost
+       extension_args:
+           - http://openid.net/extensions/sreg/1.1
+           - required: email
+             optional: fullname,nickname,timezone
 
 B<NB>: There is no OpenID store yet.
 
+=head2 EXTENSIONS TO OPENID
+
+The L<Simple Registration|http://openid.net/extensions/sreg/1.1> (SREG) extension to OpenID is supported in the L<Net::OpenID> family now. Experimental support for it is included here as of v0.12. SREG is the only supported extension in OpenID 1.1. It's experimental in the sense it's a new interface and barely tested. Support for OpenID extensions is here to stay.
+
 =head2 MORE ON CONFIGURATION
 
 These are set in your realm. See above.
@@ -421,6 +447,8 @@
 
 =head1 TODO
 
+Support more of the new methods in the L<Net::OpenID> kit.
+
 There are some interesting implications with this sort of setup. Does
 a user aggregate realms or can a user be signed in under more than one
 realm? The documents could contain a recipe of the self-answering
@@ -435,15 +463,15 @@
 
 =head1 THANKS
 
-To Benjamin Trott (L<Catalyst::Plugin::Authentication::OpenID>), Tatsuhiko Miyagawa (L<Catalyst::Plugin::Authentication::Credential::OpenID>), and Brad Fitzpatrick for the great OpenID stuff and to Jay Kuri and everyone else who has made Catalyst such a wonderful framework.
+To Benjamin Trott (L<Catalyst::Plugin::Authentication::OpenID>), Tatsuhiko Miyagawa (L<Catalyst::Plugin::Authentication::Credential::OpenID>), Brad Fitzpatrick for the great OpenID stuff, Martin Atkins for picking up the code to handle OpenID 2.0, and Jay Kuri and everyone else who has made Catalyst such a wonderful framework.
 
+L<Meno Blom|http://search.cpan.org/~blom/> provided a bug fix and the hook to use OpenID extensions.
+
 =head1 LICENSE AND COPYRIGHT
 
-Copyright (c) 2008, Ashley Pond V C<< <ashley at cpan.org> >>. Some of
-Tatsuhiko Miyagawa's work is reused here.
+Copyright (c) 2008, Ashley Pond V C<< <ashley at cpan.org> >>. Some of Tatsuhiko Miyagawa's work is reused here.
 
-This module is free software; you can redistribute it and modify it
-under the same terms as Perl itself. See L<perlartistic>.
+This module is free software; you can redistribute it and modify it under the same terms as Perl itself. See L<perlartistic>.
 
 =head1 DISCLAIMER OF WARRANTY
 
@@ -474,8 +502,7 @@
 
 =item OpenID
 
-L<Net::OpenID::Server>, L<Net::OpenID::VerifiedIdentity>,
-L<Net::OpenID::Consumer>, L<http://openid.net/>, and L<http://openid.net/developers/specs/>.
+L<Net::OpenID::Server>, L<Net::OpenID::VerifiedIdentity>, L<Net::OpenID::Consumer>, L<http://openid.net/>, L<http://openid.net/developers/specs/>, and L<http://openid.net/extensions/sreg/1.1>.
 
 =item Catalyst Authentication
 

Modified: Catalyst-Authentication-Credential-OpenID/0.12/t/TestApp/lib/TestApp.pm
===================================================================
--- Catalyst-Authentication-Credential-OpenID/0.11/t/TestApp/lib/TestApp.pm	2008-10-06 18:54:31 UTC (rev 8511)
+++ Catalyst-Authentication-Credential-OpenID/0.12/t/TestApp/lib/TestApp.pm	2008-12-02 03:27:49 UTC (rev 8684)
@@ -14,7 +14,7 @@
                 Session::State::Cookie
                 );
 
-our $VERSION = '0.02';
+our $VERSION = '0.03';
 
 __PACKAGE__->config
     ( name => "TestApp",
@@ -37,7 +37,7 @@
                                   paco => {
                                       password => "l4s4v3n7ur45",
                                   },
-                              }                       
+                              }
                           }
               },
               openid => {
@@ -47,10 +47,17 @@
                       whitelisted_hosts => [qw/ 127.0.0.1 localhost /],
                       timeout => 10,
                   },
+                  extension_args => [
+                      'http://openid.net/extensions/sreg/1.1',
+                      {
+                       required => 'email',
+                       optional => 'fullname,nickname,timezone',
+                      },
+                  ],
                   debug => 1,
                   credential => {
                       class => "OpenID",
-#DOES NOTHING                      use_session => 1        
+#DOES NOTHING                      use_session => 1,
                       store => {
                           class => "OpenID",
                       },
@@ -60,8 +67,7 @@
       },
       );
 
-# Start the application
-__PACKAGE__->setup;
+__PACKAGE__->setup();
 
 1;
 




More information about the Catalyst-commits mailing list