Catalyst-Authentication-Credential-OpenID
view release on metacpan or search on metacpan
lib/Catalyst/Authentication/Credential/OpenID.pm view on Meta::CPAN
{
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);
if ( ref $user_obj )
{
return $user_obj;
}
else
{
$c->log->debug("Verified OpenID identity failed to load with find_user; bad user_class? Try 'Null.'") if $self->debug;
return;
}
}
else
{
$self->errors_are_fatal ?
Catalyst::Exception->throw("Error validating identity: " . $csr->err)
:
$c->log->error( $csr->err);
}
}
return;
}
1;
__END__
=head1 NAME
Catalyst::Authentication::Credential::OpenID - OpenID credential for Catalyst::Plugin::Authentication framework.
=head1 BACKWARDS COMPATIBILITY CHANGES
=head2 EXTENSION_ARGS v EXTENSIONS
B<NB>: The extensions were previously configured under the key C<extension_args>. They are now configured under C<extensions>. C<extension_args> is no longer honored.
As previously noted, L</EXTENSIONS TO OPENID>, I have not tested the extensions. I would be grateful for any feedback or, better, tests.
=head2 FATALS
The problems encountered by failed OpenID operations have always been fatals in the past. This is unexpected behavior for most users as it differs from other credentials. Authentication errors here are no longer fatal. Debug/error output is improved ...
=head1 SYNOPSIS
In MyApp.pm-
use Catalyst qw/
Authentication
Session
Session::Store::FastMmap
Session::State::Cookie
/;
Somewhere in myapp.conf-
<Plugin::Authentication>
default_realm openid
<realms>
<openid>
<credential>
class OpenID
ua_class LWP::UserAgent
</credential>
</openid>
</realms>
</Plugin::Authentication>
Or in your myapp.yml if you're using L<YAML> instead-
Plugin::Authentication:
default_realm: openid
realms:
openid:
credential:
class: OpenID
ua_class: LWP::UserAgent
In a controller, perhaps C<Root::openid>-
sub openid : Local {
my($self, $c) = @_;
if ( $c->authenticate() )
{
$c->flash(message => "You signed in with OpenID!");
$c->res->redirect( $c->uri_for('/') );
}
else
{
# Present OpenID form.
}
}
And a L<Template> to match in C<openid.tt>-
<form action="[% c.uri_for('/openid') %]" method="GET" name="openid">
<input type="text" name="openid_identifier" class="openid" />
<input type="submit" value="Sign in with OpenID" />
</form>
=head1 DESCRIPTION
This is the B<third> OpenID related authentication piece for
L<Catalyst>. The first E<mdash> L<Catalyst::Plugin::Authentication::OpenID>
by Benjamin Trott E<mdash> was deprecated by the second E<mdash>
L<Catalyst::Plugin::Authentication::Credential::OpenID> by Tatsuhiko
Miyagawa E<mdash> and this is an attempt to deprecate both by conforming to
the newish, at the time of this module's inception, realm-based
authentication in L<Catalyst::Plugin::Authentication>.
1. Catalyst::Plugin::Authentication::OpenID
( run in 1.354 second using v1.01-cache-2.11-cpan-39bf76dae61 )