Catalyst-Plugin-Authentication-Credential-OpenID-0.03/0000755000175000017500000000000010710446707024243 5ustar miyagawamiyagawa00000000000000Catalyst-Plugin-Authentication-Credential-OpenID-0.03/Changes0000644000175000017500000000107610710446343025536 0ustar miyagawamiyagawa00000000000000Revision history for Perl extension Catalyst::Plugin::Authentication::Credential::OpenID 0.03 Fri Oct 26 13:22:10 PDT 2007 - Removed t/9*.t from MANIFEST since they're never supposed to be shipped (Thanks to rjbs) - Accepts URI as an authenticate_openid()'s 2nd parameter so you can use parameter name other than "claimed_uri". 0.02 Wed May 2 17:05:02 PDT 2007 - Added delayed_return => 1 to work with claimid.com (Thanks to Marcus Ramberg for the report) 0.01 Thu Dec 7 23:47:51 2006 - original version Catalyst-Plugin-Authentication-Credential-OpenID-0.03/MANIFEST0000644000175000017500000000104510710255317025367 0ustar miyagawamiyagawa00000000000000.shipit Changes inc/Module/Install.pm inc/Module/Install/Base.pm inc/Module/Install/Can.pm inc/Module/Install/Fetch.pm inc/Module/Install/Include.pm inc/Module/Install/Makefile.pm inc/Module/Install/Metadata.pm inc/Module/Install/TestBase.pm inc/Module/Install/Win32.pm inc/Module/Install/WriteAll.pm inc/Spiffy.pm inc/Test/Base.pm inc/Test/Base/Filter.pm inc/Test/Builder.pm inc/Test/Builder/Module.pm inc/Test/More.pm lib/Catalyst/Plugin/Authentication/Credential/OpenID.pm Makefile.PL MANIFEST This list of files META.yml README t/00_compile.t Catalyst-Plugin-Authentication-Credential-OpenID-0.03/.shipit0000644000175000017500000000040210616223513025531 0ustar miyagawamiyagawa00000000000000steps = FindVersion, ChangeVersion, CheckChangeLog, DistTest, Commit, Tag, MakeDist, UploadCPAN # if directory, where the normal "make dist" puts its file. #MakeDist.destination = ~/shipit-dist #svn.tagpattern = ShipIt-%v #CheckChangeLog.files = ChangeLog Catalyst-Plugin-Authentication-Credential-OpenID-0.03/META.yml0000644000175000017500000000064010710446706025513 0ustar miyagawamiyagawa00000000000000abstract: OpenID credential for Catalyst::Auth framework author: Six Apart, Ltd. build_requires: Test::More: 0 distribution_type: module generated_by: Module::Install version 0.64 license: perl name: Catalyst-Plugin-Authentication-Credential-OpenID no_index: directory: - inc - t requires: LWPx::ParanoidAgent: 0 Net::OpenID::Consumer: 0 UNIVERSAL::require: 0 version: 0.03 Catalyst-Plugin-Authentication-Credential-OpenID-0.03/lib/0000755000175000017500000000000010710446707025011 5ustar miyagawamiyagawa00000000000000Catalyst-Plugin-Authentication-Credential-OpenID-0.03/lib/Catalyst/0000755000175000017500000000000010710446707026575 5ustar miyagawamiyagawa00000000000000Catalyst-Plugin-Authentication-Credential-OpenID-0.03/lib/Catalyst/Plugin/0000755000175000017500000000000010710446707030033 5ustar miyagawamiyagawa00000000000000Catalyst-Plugin-Authentication-Credential-OpenID-0.03/lib/Catalyst/Plugin/Authentication/0000755000175000017500000000000010710446707033012 5ustar miyagawamiyagawa00000000000000././@LongLink0000644000175000017500000000014510710446707011332 Lustar 00000000000000Catalyst-Plugin-Authentication-Credential-OpenID-0.03/lib/Catalyst/Plugin/Authentication/Credential/Catalyst-Plugin-Authentication-Credential-OpenID-0.03/lib/Catalyst/Plugin/Authentication/Credential/0000755000175000017500000000000010710446707035064 5ustar miyagawamiyagawa00000000000000././@LongLink0000644000175000017500000000015610710446707011334 Lustar 00000000000000Catalyst-Plugin-Authentication-Credential-OpenID-0.03/lib/Catalyst/Plugin/Authentication/Credential/OpenID.pmCatalyst-Plugin-Authentication-Credential-OpenID-0.03/lib/Catalyst/Plugin/Authentication/Credential/0000644000175000017500000001271310710446653035072 0ustar miyagawamiyagawa00000000000000package Catalyst::Plugin::Authentication::Credential::OpenID; use strict; use warnings; our $VERSION = '0.03'; use Net::OpenID::Consumer; use LWPx::ParanoidAgent; use UNIVERSAL::require; sub setup { my $c = shift; my $config = $c->config->{authentication}->{openid} ||= {}; ( $config->{user_class} ||= "Catalyst::Plugin::Authentication::User::Hash" )->require; $c->NEXT::setup(@_); } sub authenticate_openid { my($c, $uri) = @_; my $config = $c->config->{authentication}->{openid}; my $csr = Net::OpenID::Consumer->new( ua => LWPx::ParanoidAgent->new, args => $c->req->params, consumer_secret => sub { $_[0] }, ); my @try_params = qw( openid_url openid_identifier claimed_uri ); if ($uri ||= (grep defined, @{$c->req->params}{@try_params})[0]) { my $current = $c->req->uri; $current->query(undef); # no query my $identity = $csr->claimed_identity($uri) or Catalyst::Exception->throw($csr->err); my $check_url = $identity->check_url( return_to => $current . '?openid-check=1', trust_root => $current, delayed_return => 1, ); $c->res->redirect($check_url); return 0; } elsif ($c->req->param('openid-check')) { if (my $setup_url = $csr->user_setup_url) { $c->res->redirect($setup_url); return 0; } elsif ($csr->user_cancel) { return 0; } elsif (my $identity = $csr->verified_identity) { my $user = +{ map { $_ => scalar $identity->$_ } qw( url display rss atom foaf declared_rss declared_atom declared_foaf foafmaker ) }; my $store = $config->{store} || $c->default_auth_store; if ( $store and my $store_user = $store->get_user( $user->{url}, $user ) ) { $c->set_authenticated($store_user); } else { $user = $config->{user_class}->new($user); $c->set_authenticated($user); } return 1; } else { Catalyst::Exception->throw("Error validating identity: " . $csr->err); } } else { return 0; } } 1; __END__ =for stopwords Flickr OpenID TypeKey app auth callback foaf foafmaker plugins rss url URI =head1 NAME Catalyst::Plugin::Authentication::Credential::OpenID - OpenID credential for Catalyst::Auth framework =head1 SYNOPSIS use Catalyst qw/ Authentication Authentication::Credential::OpenID Session Session::Store::FastMmap Session::State::Cookie /; # MyApp.yaml -- optional authentication: openid: use_session: 1 user_class: MyApp::M::User::OpenID # whatever in your Controller pm sub default : Private { my($self, $c) = @_; if ($c->user_exists) { ... } } sub signin_openid : Local { my($self, $c) = @_; if ($c->authenticate_openid) { $c->res->redirect( $c->uri_for('/') ); } } # foo.tt
=head1 DESCRIPTION Catalyst::Plugin::Authentication::Credential::OpenID is an OpenID credential for Catalyst::Plugin::Authentication framework. =head1 METHODS =over 4 =item authenticate_openid $c->authenticate_openid; Call this method in the action you'd like to authenticate the user via OpenID. Returns 0 if auth is not successful, and 1 if user is authenticated. User class specified with I config, which defaults to Catalyst::Plugin::Authentication::User::Hash, will be instantiated with the following parameters. By default, L method looks for claimed URI parameter from the form field named C, C or C. If you want to use another form field name, call it like: $c->authenticate_openid( $c->req->param('myopenid_param') ); =over 8 =item url =item display =item rss =item atom =item foaf =item declared_rss =item declared_atom =item declared_foaf =item foafmaker =back See L for details. =back =head1 DIFFERENCE WITH Authentication::OpenID There's already Catalyst::Plugin::Authentication::OpenID (Auth::OpenID) and this plugin tries to deprecate it. =over 4 =item * Don't use this plugin with Auth::OpenID since method names will conflict and your app won't work. =item * Auth::OpenID uses your root path (/) as an authentication callback but this plugin uses the current path, which means you can use this plugin with other Credential plugins, like Flickr or TypeKey. =item * This plugin is NOT a drop-in replacement for Auth::OpenID, but your app needs only slight modifications to work with this one. =item * This plugin is based on Catalyst authentication framework, which means you can specify I or I in your app config and this modules does the right thing, like other Credential modules. This crates new User object if authentication is successful, and works with Session too. =back =head1 AUTHOR Six Apart, Ltd. Ecpan@sixapart.comE =head1 LICENSE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO L, L =cut Catalyst-Plugin-Authentication-Credential-OpenID-0.03/t/0000755000175000017500000000000010710446707024506 5ustar miyagawamiyagawa00000000000000Catalyst-Plugin-Authentication-Credential-OpenID-0.03/t/00_compile.t0000644000175000017500000000016010536217107026613 0ustar miyagawamiyagawa00000000000000use strict; use Test::More tests => 1; BEGIN { use_ok 'Catalyst::Plugin::Authentication::Credential::OpenID' } Catalyst-Plugin-Authentication-Credential-OpenID-0.03/README0000644000175000017500000000131110536217110025105 0ustar miyagawamiyagawa00000000000000This is Perl module Catalyst::Plugin::Authentication::Credential::OpenID. INSTALLATION Catalyst::Plugin::Authentication::Credential::OpenID installation is straightforward. If your CPAN shell is set up, you should just be able to do % cpan Catalyst::Plugin::Authentication::Credential::OpenID Download it, unpack it, then build it as per the usual: % perl Makefile.PL % make && make test Then install it: % make install DOCUMENTATION Catalyst::Plugin::Authentication::Credential::OpenID documentation is available as in POD. So you can do: % perldoc Catalyst::Plugin::Authentication::Credential::OpenID to read the documentation online with your favorite pager. Tatsuhiko Miyagawa Catalyst-Plugin-Authentication-Credential-OpenID-0.03/Makefile.PL0000644000175000017500000000047610536217110026212 0ustar miyagawamiyagawa00000000000000use inc::Module::Install; name 'Catalyst-Plugin-Authentication-Credential-OpenID'; all_from 'lib/Catalyst/Plugin/Authentication/Credential/OpenID.pm'; requires 'Net::OpenID::Consumer'; requires 'LWPx::ParanoidAgent'; requires 'UNIVERSAL::require'; build_requires 'Test::More'; use_test_base; auto_include; WriteAll;