[Catalyst-commits] r7158 - in trunk/Catalyst-Plugin-Authentication:
lib/Catalyst lib/Catalyst/Authentication
lib/Catalyst/Authentication/Credential
lib/Catalyst/Authentication/Realm lib/Catalyst/Authentication/Store
lib/Catalyst/Authentication/User lib/Catalyst/Plugin
lib/Catalyst/Plugin/Authentication
lib/Catalyst/Plugin/Authentication/Credential
lib/Catalyst/Plugin/Authentication/Store t t/lib
jayk at dev.catalyst.perl.org
jayk at dev.catalyst.perl.org
Fri Nov 23 06:23:15 GMT 2007
Author: jayk
Date: 2007-11-23 06:23:14 +0000 (Fri, 23 Nov 2007)
New Revision: 7158
Added:
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Credential/
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm/
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store.pod
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User/
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Credential/
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Credential/Password.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store/
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store/Minimal.pm
Removed:
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Credential/
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Realm.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Realm/
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store.pod
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store/
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/User.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/User/
Modified:
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Credential/Password.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm/Compatibility.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Minimal.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Null.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User/Hash.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm
trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Internals.pod
trunk/Catalyst-Plugin-Authentication/t/05_password.t
trunk/Catalyst-Plugin-Authentication/t/06_user.t
trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm
Log:
Convert everything not actually a plugin to now live in the
Catalyst::Authentication hierarchy instead of the
Catalyst::Plugin::Authentication hierarchy. it just makes sense.
Copied: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Credential (from rev 7064, trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Credential)
Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Credential/Password.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Credential/Password.pm 2007-10-26 01:31:49 UTC (rev 7064)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Credential/Password.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -1,4 +1,4 @@
-package Catalyst::Plugin::Authentication::Credential::Password;
+package Catalyst::Authentication::Credential::Password;
use strict;
use warnings;
@@ -125,7 +125,7 @@
}
unless ( Scalar::Util::blessed($user)
- and $user->isa("Catalyst::Plugin::Authentication::User") )
+ and $user->isa("Catalyst::Authentication::User") )
{
if ( my $user_obj = $c->get_user( $user, $password, @rest ) ) {
$user = $user_obj;
@@ -209,7 +209,7 @@
=head1 NAME
-Catalyst::Plugin::Authentication::Credential::Password - Authenticate a user
+Catalyst::Authentication::Credential::Password - Authenticate a user
with a password.
=head1 SYNOPSIS
@@ -265,7 +265,7 @@
The classname used for Credential. This is part of
L<Catalyst::Plugin::Authentication> and is the method by which
-Catalyst::Plugin::Authentication::Credential::Password is loaded as the
+Catalyst::Authentication::Credential::Password is loaded as the
credential validator. For this module to be used, this must be set to
'Password'.
Copied: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm (from rev 7058, trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Realm)
Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm/Compatibility.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Realm/Compatibility.pm 2007-10-25 16:14:43 UTC (rev 7058)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm/Compatibility.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -1,9 +1,9 @@
-package Catalyst::Plugin::Authentication::Realm::Compatibility;
+package Catalyst::Authentication::Realm::Compatibility;
use strict;
use warnings;
-use base qw/Catalyst::Plugin::Authentication::Realm/;
+use base qw/Catalyst::Authentication::Realm/;
## very funky - the problem here is that we can't do real realm initialization
## but we need a real realm object to function. So - we kinda fake it - we
@@ -27,7 +27,7 @@
=head1 NAME
-Catalyst::Plugin::Authentication::Realm::Compatibility - Compatibility realm object
+Catalyst::Authentication::Realm::Compatibility - Compatibility realm object
=head1 DESCRIPTION
Copied: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm (from rev 7153, trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Realm.pm)
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm (rev 0)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Realm.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -0,0 +1,222 @@
+package Catalyst::Authentication::Realm;
+
+use strict;
+use warnings;
+
+use base qw/Class::Accessor::Fast/;
+
+BEGIN {
+ __PACKAGE__->mk_accessors(qw/store credential name config/);
+};
+
+sub new {
+ my ($class, $realmname, $config, $app) = @_;
+
+ my $self = { config => $config };
+ bless $self, $class;
+
+ $self->name($realmname);
+
+ $app->log->debug("Setting up auth realm $realmname") if $app->debug;
+
+ # use the Null store as a default
+ if( ! exists $config->{store}{class} ) {
+ $config->{store}{class} = '+Catalyst::Authentication::Store::Null';
+ $app->log->debug( qq(No Store specified for realm "$realmname", using the Null store.) );
+ }
+ my $storeclass = $config->{'store'}{'class'};
+
+ ## follow catalyst class naming - a + prefix means a fully qualified class, otherwise it's
+ ## taken to mean C::P::A::Store::(specifiedclass)
+ if ($storeclass !~ /^\+(.*)$/ ) {
+ $storeclass = "Catalyst::Authentication::Store::${storeclass}";
+ } else {
+ $storeclass = $1;
+ }
+
+ # a little niceness - since most systems seem to use the password credential class,
+ # if no credential class is specified we use password.
+ $config->{credential}{class} ||= '+Catalyst::Authentication::Credential::Password';
+
+ my $credentialclass = $config->{'credential'}{'class'};
+
+ ## follow catalyst class naming - a + prefix means a fully qualified class, otherwise it's
+ ## taken to mean C::A::Credential::(specifiedclass)
+ if ($credentialclass !~ /^\+(.*)$/ ) {
+ $credentialclass = "Catalyst::Authentication::Credential::${credentialclass}";
+ } else {
+ $credentialclass = $1;
+ }
+
+ # if we made it here - we have what we need to load the classes
+
+ ### BACKWARDS COMPATIBILITY - DEPRECATION WARNING:
+ ### we must eval the ensure_class_loaded - because we might need to try the old-style
+ ### ::Plugin:: module naming if the standard method fails.
+
+ eval {
+ Catalyst::Utils::ensure_class_loaded( $credentialclass );
+ };
+
+ if ($@) {
+ $app->log->warn( qq(Credential class "$credentialclass" not found, trying deprecated ::Plugin:: style naming. ) );
+ $credentialclass =~ s/Catalyst::Authentication/Catalyst::Plugin::Authentication/;
+ Catalyst::Utils::ensure_class_loaded( $credentialclass );
+ }
+
+ eval {
+ Catalyst::Utils::ensure_class_loaded( $storeclass );
+ };
+
+ if ($@) {
+ $app->log->warn( qq(Store class "$storeclass" not found, trying deprecated ::Plugin:: style naming. ) );
+ $storeclass =~ s/Catalyst::Authentication/Catalyst::Plugin::Authentication/;
+ Catalyst::Utils::ensure_class_loaded( $storeclass );
+ }
+
+ # BACKWARDS COMPATIBILITY - if the store class does not define find_user, we define it in terms
+ # of get_user and add it to the class. this is because the auth routines use find_user,
+ # and rely on it being present. (this avoids per-call checks)
+ if (!$storeclass->can('find_user')) {
+ no strict 'refs';
+ *{"${storeclass}::find_user"} = sub {
+ my ($self, $info) = @_;
+ my @rest = @{$info->{rest}} if exists($info->{rest});
+ $self->get_user($info->{id}, @rest);
+ };
+ }
+
+ ## a little cruft to stay compatible with some poorly written stores / credentials
+ ## we'll remove this soon.
+ if ($storeclass->can('new')) {
+ $self->store($storeclass->new($config->{'store'}, $app, $self));
+ } else {
+ $app->log->error("THIS IS DEPRECATED: $storeclass has no new() method - Attempting to use uninstantiated");
+ $self->store($storeclass);
+ }
+ if ($credentialclass->can('new')) {
+ $self->credential($credentialclass->new($config->{'credential'}, $app, $self));
+ } else {
+ $app->log->error("THIS IS DEPRECATED: $credentialclass has no new() method - Attempting to use uninstantiated");
+ $self->credential($credentialclass);
+ }
+
+ return $self;
+}
+
+sub find_user {
+ my ( $self, $authinfo, $c ) = @_;
+
+ my $res = $self->store->find_user($authinfo, $c);
+
+ if (!$res) {
+ if ($self->config->{'auto_create_user'} && $self->store->can('auto_create_user') ) {
+ $res = $self->store->auto_create_user($authinfo, $c);
+ }
+ } elsif ($self->config->{'auto_update_user'} && $self->store->can('auto_update_user')) {
+ $res = $self->store->auto_update_user($authinfo, $c, $res);
+ }
+
+ return $res;
+}
+
+sub authenticate {
+ my ($self, $c, $authinfo) = @_;
+
+ my $user = $self->credential->authenticate($c, $self, $authinfo);
+ if (ref($user)) {
+ $c->set_authenticated($user, $self->name);
+ return $user;
+ } else {
+ return undef;
+ }
+}
+
+sub save_user_in_session {
+ my ( $self, $c, $user ) = @_;
+
+ $c->session->{__user_realm} = $self->name;
+
+ # we want to ask the store for a user prepared for the session.
+ # but older modules split this functionality between the user and the
+ # store. We try the store first. If not, we use the old method.
+ if ($self->store->can('for_session')) {
+ $c->session->{__user} = $self->store->for_session($c, $user);
+ } else {
+ $c->session->{__user} = $user->for_session;
+ }
+}
+
+sub from_session {
+ my ($self, $c, $frozen_user) = @_;
+
+ return $self->store->from_session($c, $frozen_user);
+}
+
+
+__PACKAGE__;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Catalyst::Authentication::Realm - Base class for realm objects.
+
+=head1 DESCRIPTION
+
+=head1 CONFIGURATION
+
+=over 4
+
+=item class
+
+By default this class is the default realm class. You can specify a custom
+realm class with this config parameter.
+
+=item auto_create_user
+
+Set this to true if you wish this realm to auto-create user accounts when the
+user doesn't exist (most useful for remote authentication schemes).
+
+=item auto_update_user
+
+Set this to true if you wish this realm to auto-update user accounts after
+authentication (most useful for remote authentication schemes).
+
+=back
+
+=head1 METHODS
+
+=head2 new( )
+
+Instantiantes this realm, plus the specified store and credential classes.
+
+=head2 store( )
+
+Holds an instance of the store object for this realm.
+
+=head2 credential( )
+
+Holds an instance of the credential object for this realm.
+
+=head2 find_user( )
+
+Delegates to the store object. Will also re-delegate auto_create_user and
+auto_update_user at this time, if necessary.
+
+=head2 authenticate( )
+
+Delegates to the credential objects and sets the authenticated user on success.
+
+=head2 save_user_in_session( )
+
+Delegates to the store object.
+
+=head2 from_session( )
+
+Delegates to the store object.
+
+=cut
+
Copied: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store (from rev 7062, trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store)
Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Minimal.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store/Minimal.pm 2007-10-25 20:39:15 UTC (rev 7062)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Minimal.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -1,10 +1,10 @@
-package Catalyst::Plugin::Authentication::Store::Minimal;
+package Catalyst::Authentication::Store::Minimal;
use strict;
use warnings;
-use Catalyst::Plugin::Authentication::User::Hash;
-use Scalar::Util ();
+use Catalyst::Authentication::User::Hash;
+use Scalar::Util qw( blessed );
use base qw/Class::Accessor::Fast/;
BEGIN {
@@ -39,27 +39,17 @@
my $user = $self->userhash->{$id};
- if ( ref $user ) {
- if ( Scalar::Util::blessed($user)
- and $user->isa('Catalyst::Plugin::Authentication::User::Hash') )
- {
- return $user;
- }
- if ( ref $user eq "HASH" ) {
- $user->{id} ||= $id;
- return bless $user, "Catalyst::Plugin::Authentication::User::Hash";
- }
- else {
- Catalyst::Exception->throw( "The user '$id' is a reference of type "
- . ref($user)
- . " but should be a HASH" );
- }
- }
- else {
- Catalyst::Exception->throw(
- "The user '$id' is has to be a hash reference or an object");
- }
+ #print STDERR "FOO1! " . ref($user) . " - ". Scalar::Util::blessed($user) . "\n";
+ if ( ref($user) eq "HASH") {
+ $user->{id} ||= $id;
+ return bless $user, "Catalyst::Authentication::User::Hash";
+ } elsif ( ref($user) && blessed($user) && $user->isa('Catalyst::Authentication::User::Hash')) {
+ return $user;
+ } else {
+ Catalyst::Exception->throw( "The user '$id' must be a hash reference or an " .
+ "object of class Catalyst::Authentication::User::Hash");
+ }
return $user;
}
@@ -104,14 +94,14 @@
=head1 NAME
-Catalyst::Plugin::Authentication::Store::Minimal - Minimal authentication store
+Catalyst::Authentication::Store::Minimal - Minimal authentication store
=head1 SYNOPSIS
# you probably just want Store::Minimal under most cases,
# but if you insist you can instantiate your own store:
- use Catalyst::Plugin::Authentication::Store::Minimal;
+ use Catalyst::Authentication::Store::Minimal;
use Catalyst qw/
Authentication
@@ -168,7 +158,7 @@
The classname used for the store. This is part of
L<Catalyst::Plugin::Authentication> and is the method by which
-Catalyst::Plugin::Authentication::Store::Minimal is loaded as the
+Catalyst::Authentication::Store::Minimal is loaded as the
user store. For this module to be used, this must be set to
'Minimal'.
@@ -201,7 +191,7 @@
... documentation fairy stopped here. ...
If the return value is unblessed it will be blessed as
-L<Catalyst::Plugin::Authentication::User::Hash>.
+L<Catalyst::Authentication::User::Hash>.
=head2 from_session( $id )
Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Null.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store/Null.pm 2007-10-25 20:39:15 UTC (rev 7062)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Null.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -1,9 +1,9 @@
-package Catalyst::Plugin::Authentication::Store::Null;
+package Catalyst::Authentication::Store::Null;
use strict;
use warnings;
-use Catalyst::Plugin::Authentication::User::Hash;
+use Catalyst::Authentication::User::Hash;
use base qw( Class::Accessor::Fast );
@@ -28,12 +28,12 @@
sub find_user {
my ( $self, $userinfo, $c ) = @_;
- return bless $userinfo, 'Catalyst::Plugin::Authentication::User::Hash';
+ return bless $userinfo, 'Catalyst::Authentication::User::Hash';
}
sub user_supports {
my $self = shift;
- Catalyst::Plugin::Authentication::User::Hash->supports(@_);
+ Catalyst::Authentication::User::Hash->supports(@_);
}
1;
@@ -44,7 +44,7 @@
=head1 NAME
-Catalyst::Plugin::Authentication::Store::Null - Null authentication store
+Catalyst::Authentication::Store::Null - Null authentication store
=head1 SYNOPSIS
@@ -91,11 +91,11 @@
=head2 find_user( )
Since this store isn't tied to any real set of users, this method just returns
-the user info bless as a L<Catalyst::Plugin::Authentication::User::Hash>
+the user info bless as a L<Catalyst::Authentication::User::Hash>
object.
=head2 user_supports( )
-Delegates to L<Catalyst::Plugin::Authentication::User::Hash>.
+Delegates to L<Catalyst::Authentication::User::Hash>.
=cut
Copied: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store.pod (from rev 6555, trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store.pod)
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store.pod (rev 0)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store.pod 2007-11-23 06:23:14 UTC (rev 7158)
@@ -0,0 +1,133 @@
+
+=head1 NAME
+
+Catalyst::Authentication::Store - All about authentication stores
+
+=head1 MULTIPLE BACKENDS
+
+B<NOTE> This is documentation for the old store system used in versions of
+L<Catalyst::Plugin::Authentication> prior to 0.10. This is NOT how the
+new realm-based stores work. This is here for reference only.
+
+See L<Catalyst::Authentication::Internals> instead.
+
+=head1 OLD STORE DOCUMENTATION BELOW
+
+A key issue to understand about authentication stores is that there are
+potentially many of them. Each one is registered into the application, and has
+a name.
+
+For most applications, there is only one, and in this framework it is called
+'default'.
+
+When you use a plugin, like
+
+ use Catalyst qw/
+ Authentication
+ Authentication::Store::Foo
+ /;
+
+the Store plugins typically only act at setup time. They rarely do more than
+check out the configuration, and register e.g. Store::Foo, and set it
+as the default store.
+
+ __PACKAGE__->default_auth_store( $store );
+
+ # the same as
+
+ __PACKAGE__->register_auth_stores( default => $store );
+
+=head1 WORKING WITH USERS
+
+All credential verifiers should accept either a user object, or a user ID.
+
+If a user ID is provided, then they will fetch the user object from the default
+store, and check against it.
+
+This should be pretty much DWIM all the time.
+
+When you need multiple authentication backends per application then you must
+fetch things yourself. For example:
+
+ my $user = $c->get_auth_store("other_store")->get_user($id);
+
+ $c->login( $user, $supplied_password );
+
+Instead of just:
+
+ $c->login( $id, $supplied_password );
+
+which will go to the default store.
+
+=head1 WRITING A BACKEND
+
+Writing an authentication storage backend is a very simple matter.
+
+The only method you really need to support is C<get_user>.
+
+This method should accept an arbitrary list of parameters (determined by you or
+the credential verifyer), and return an object inheriting
+L<Catalyst::Authentication::User>.
+
+For introspection purposes you can also define the C<user_supports> method. See
+below for optional features. This is not necessary, but might be in the future.
+
+=head2 Integrating with Catalyst::Plugin::Session
+
+If your users support sessions, your store should also define the
+C<from_session> method. When the user object is saved in the session the
+C<for_session> method is called, and that is used as the value in the session
+(typically a user id). The store is also saved in the hash. If
+C<<$user->store>> returns something registered, that store's name is used. If
+not, the user's class is used as if it were a store (and must also support
+C<from_session>).
+
+=head2 Optional Features
+
+Each user has the C<supports> method. For example:
+
+ $user->supports(qw/password clear/);
+
+should return a true value if this specific user has a clear text password.
+
+This is on a per user (not necessarily a per store) basis. To make assumptions
+about the store as a whole,
+
+ $store->user_supports(qw/password clear/);
+
+is supposed to be the lowest common denominator.
+
+The standardization of these values is to be goverened by the community,
+typically defined by the credential verification plugins.
+
+=head2 Stores implying certain credentials
+
+Sometimes a store is agnostic to the credentials (DB storage, for example), but
+sometimes it isn't (like an Htpasswd file).
+
+If you are writing a backend that wraps around a module, like
+L<Catalyst::Authentication::Store::Htpasswd> wraps around
+L<Authen::Htpasswd>, it makes sense to delegate the credential checks.
+
+This particular example caused the following "feature" to be added:
+
+ $user->supports(qw/password self_check/);
+
+=head2 Writing a plugin to go with the backend
+
+Typically the backend will do the heavy lifting, by registering a store.
+
+These plugins should look something like this:
+
+ sub setup {
+ my $c = shift;
+
+ $c->default_auth_store(
+ # a store can be an object or a class
+ Catalyst::Authentication::Store::Foo::Backend->new(
+ ...
+ )
+ );
+
+ $c->NEXT::setup(@_);
+ }
Copied: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User (from rev 7062, trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/User)
Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User/Hash.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/User/Hash.pm 2007-10-25 20:39:15 UTC (rev 7062)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User/Hash.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -1,9 +1,9 @@
-package Catalyst::Plugin::Authentication::User::Hash;
+package Catalyst::Authentication::User::Hash;
use strict;
use warnings;
-use base qw/Catalyst::Plugin::Authentication::User/;
+use base qw/Catalyst::Authentication::User/;
sub new {
my $class = shift;
@@ -106,21 +106,21 @@
=head1 NAME
-Catalyst::Plugin::Authentication::User::Hash - An easy authentication user
+Catalyst::Authentication::User::Hash - An easy authentication user
object based on hashes.
=head1 SYNOPSIS
- use Catalyst::Plugin::Authentication::User::Hash;
+ use Catalyst::Authentication::User::Hash;
- Catalyst::Plugin::Authentication::User::Hash->new(
+ Catalyst::Authentication::User::Hash->new(
password => "s3cr3t",
);
=head1 DESCRIPTION
This implementation of authentication user handles is supposed to go hand in
-hand with L<Catalyst::Plugin::Authentication::Store::Minimal>.
+hand with L<Catalyst::Authentication::Store::Minimal>.
=head1 METHODS
Copied: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User.pm (from rev 7062, trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/User.pm)
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User.pm (rev 0)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/User.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -0,0 +1,114 @@
+package Catalyst::Authentication::User;
+
+use strict;
+use warnings;
+use base qw/Class::Accessor::Fast/;
+
+## auth_realm is the realm this user came from.
+BEGIN {
+ __PACKAGE__->mk_accessors(qw/auth_realm store/);
+}
+
+## THIS IS NOT A COMPLETE CLASS! it is intended to provide base functionality only.
+## translation - it won't work if you try to use it directly.
+
+## chances are you want to override this.
+sub id { shift->get('id'); }
+
+## this relies on 'supported_features' being implemented by the subclass..
+## but it is not an error if it is not. it just means you support nothing.
+## nihilist user objects are welcome here.
+sub supports {
+ my ( $self, @spec ) = @_;
+
+ my $cursor = undef;
+ if ($self->can('supported_features')) {
+ $cursor = $self->supported_features;
+
+ # traverse the feature list,
+ for (@spec) {
+ #die "bad feature spec: @spec" if ref($cursor) ne "HASH";
+ return if ref($cursor) ne "HASH";
+
+ $cursor = $cursor->{$_};
+ }
+ }
+
+ return $cursor;
+}
+
+## REQUIRED.
+## get should return the value of the field specified as it's single argument from the underlying
+## user object. This is here to provide a simple, standard way of accessing individual elements of a user
+## object - ensuring no overlap between C::P::A::User methods and actual fieldnames.
+## this is not the most effecient method, since it uses introspection. If you have an underlying object
+## you most likely want to write this yourself.
+sub get {
+ my ($self, $field) = @_;
+
+ my $object;
+ if ($object = $self->get_object and $object->can($field)) {
+ return $object->$field();
+ } else {
+ return undef;
+ }
+}
+
+## REQUIRED.
+## get_object should return the underlying user object. This is for when more advanced uses of the
+## user is required. Modifications to the existing user, etc. Changes in the object returned
+## by this routine may not be reflected in the C::P::A::User object - if this is required, re-authenticating
+## the user is probably the best route to take.
+## note that it is perfectly acceptable to return $self in cases where there is no underlying object.
+sub get_object {
+ return shift;
+}
+
+## Backwards Compatibility
+## you probably want auth_realm, in fact. but this does work for backwards compatibility.
+## store should be a read-write accessor - so it was moved to mk_accessors
+##sub store {
+## my ($self) = @_;
+## return $self->auth_realm->{store};
+##}
+
+__PACKAGE__;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Catalyst::Authentication::User - Base class for user objects.
+
+=head1 SYNOPSIS
+
+ package MyStore::User;
+ use base qw/Catalyst::Authentication::User/;
+
+=head1 DESCRIPTION
+
+This is the base class for authenticated
+
+=head1 METHODS
+
+=head2 id( )
+
+A unique ID by which a user can be retrieved from the store.
+
+=head2 store( )
+
+Should return a class name that can be used to refetch the user using it's
+ID.
+
+=head2 supports( )
+
+An introspection method used to determine what features a user object has, to support credential and authorization plugins.
+
+=head2 get( )
+
+=head2 get_object( )
+
+=cut
+
Added: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Credential/Password.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Credential/Password.pm (rev 0)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Credential/Password.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -0,0 +1,25 @@
+package Catalyst::Plugin::Authentication::Credential::Password;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Authentication::Credential::Password/;
+
+__PACKAGE__;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Catalyst::Plugin::Authentication::Credential::Password - Compatibility shim
+
+=head1 DESCRIPTION
+
+THIS IS A COMPATIBILITY SHIM. It allows old configurations of Catalyst
+Authentication to work without code changes.
+
+Please see L<Catalyst::Authentication::Credential::Password> for more information.
+
+
Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Internals.pod
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Internals.pod 2007-11-23 00:07:58 UTC (rev 7157)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Internals.pod 2007-11-23 06:23:14 UTC (rev 7158)
@@ -271,14 +271,14 @@
part of the system that the application developer will interact with most. As
such, the API for the user object is very rigid. All user objects B<MUST>
inherit from
-L<Catalyst::Plugin::Authentication::User|Catalyst::Plugin::Authentication::User>.
+L<Catalyst::Authentication::User|Catalyst::Authentication::User>.
=head3 USER METHODS
The routines required by the
L<Catalyst::Plugin::Authentication|Catalyst::Plugin::Authentication> plugin
are below. Note that of these, only get_object is strictly required, as the
-L<Catalyst::Plugin::Authentication::User|Catalyst::Plugin::Authentication::User>
+L<Catalyst::Authentication::User|Catalyst::Authentication::User>
base class contains reasonable implementations of the rest. If you do choose
to implement only the C<get_object()> routine, please read the base class code
and documentation so that you fully understand how the other routines will be
@@ -304,7 +304,7 @@
is implemented such that each argument provides a subfeature of the previous
argument. In other words, passing 'foo', 'bar' would return true if the user
supported the 'foo' feature, and the 'bar' feature of 'foo'. This is implemented
-in Catalyst::Plugin::Authentication::User, so if your class inherits from that, you
+in Catalyst::Authentication::User, so if your class inherits from that, you
do not need to implement this and can instead implement supported_features().
B<Note:> If you want the authentication module to be able to save your user in
@@ -402,7 +402,7 @@
certainly expecting the user to be found using the information provided
to $c->authenticate().
-Look at the L<Catalyst::Plugin::Authentication::Credential::Password|Catalyst::Plugin::Authentication::Credential::Password>
+Look at the L<Catalyst::Authentication::Credential::Password|Catalyst::Authentication::Credential::Password>
module source to see this in action. In order to avoid possible
mismatches between the encrypted and unencrypted passwords, the password
credential actually removes the provided password from the authinfo
@@ -418,9 +418,9 @@
place those arguments that are specific to your credential
within their own subhash named after your module.
-The L<Catalyst::Plugin::Authentication::Store::DBIx::Class|Catalyst::Plugin::Authentication::Store::DBIx::Class> module does this
+The L<Catalyst::Authentication::Store::DBIx::Class|Catalyst::Authentication::Store::DBIx::Class> module does this
in order to encapsulate arguments intended specifically for
-that module. See the L<Catalyst::Plugin::Authentication::Store::DBIx::Class::User|Catalyst::Plugin::Authentication::Store::DBIx::Class::User>
+that module. See the L<Catalyst::Authentication::Store::DBIx::Class::User|Catalyst::Authentication::Store::DBIx::Class::User>
source for details.
=back
Deleted: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Realm.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Realm.pm 2007-11-23 00:07:58 UTC (rev 7157)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Realm.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -1,222 +0,0 @@
-package Catalyst::Plugin::Authentication::Realm;
-
-use strict;
-use warnings;
-
-use base qw/Class::Accessor::Fast/;
-
-BEGIN {
- __PACKAGE__->mk_accessors(qw/store credential name config/);
-};
-
-sub new {
- my ($class, $realmname, $config, $app) = @_;
-
- my $self = { config => $config };
- bless $self, $class;
-
- $self->name($realmname);
-
- $app->log->debug("Setting up auth realm $realmname") if $app->debug;
-
- # use the Null store as a default
- if( ! exists $config->{store}{class} ) {
- $config->{store}{class} = '+Catalyst::Authentication::Store::Null';
- $app->log->debug( qq(No Store specified for realm "$realmname", using the Null store.) );
- }
- my $storeclass = $config->{'store'}{'class'};
-
- ## follow catalyst class naming - a + prefix means a fully qualified class, otherwise it's
- ## taken to mean C::P::A::Store::(specifiedclass)
- if ($storeclass !~ /^\+(.*)$/ ) {
- $storeclass = "Catalyst::Authentication::Store::${storeclass}";
- } else {
- $storeclass = $1;
- }
-
- # a little niceness - since most systems seem to use the password credential class,
- # if no credential class is specified we use password.
- $config->{credential}{class} ||= '+Catalyst::Authentication::Credential::Password';
-
- my $credentialclass = $config->{'credential'}{'class'};
-
- ## follow catalyst class naming - a + prefix means a fully qualified class, otherwise it's
- ## taken to mean C::A::Credential::(specifiedclass)
- if ($credentialclass !~ /^\+(.*)$/ ) {
- $credentialclass = "Catalyst::Authentication::Credential::${credentialclass}";
- } else {
- $credentialclass = $1;
- }
-
- # if we made it here - we have what we need to load the classes
-
- ### BACKWARDS COMPATIBILITY - DEPRECATION WARNING:
- ### we must eval the ensure_class_loaded - because we might need to try the old-style
- ### ::Plugin:: module naming if the standard method fails.
-
- eval {
- Catalyst::Utils::ensure_class_loaded( $credentialclass );
- };
-
- if ($@) {
- $app->log->warn( qq(Credential class "$credentialclass" not found, trying deprecated ::Plugin:: style naming. ) );
- $credentialclass =~ s/Catalyst::Authentication/Catalyst::Plugin::Authentication/;
- Catalyst::Utils::ensure_class_loaded( $credentialclass );
- }
-
- eval {
- Catalyst::Utils::ensure_class_loaded( $storeclass );
- };
-
- if ($@) {
- $app->log->warn( qq(Store class "$storeclass" not found, trying deprecated ::Plugin:: style naming. ) );
- $storeclass =~ s/Catalyst::Authentication/Catalyst::Plugin::Authentication/;
- Catalyst::Utils::ensure_class_loaded( $storeclass );
- }
-
- # BACKWARDS COMPATIBILITY - if the store class does not define find_user, we define it in terms
- # of get_user and add it to the class. this is because the auth routines use find_user,
- # and rely on it being present. (this avoids per-call checks)
- if (!$storeclass->can('find_user')) {
- no strict 'refs';
- *{"${storeclass}::find_user"} = sub {
- my ($self, $info) = @_;
- my @rest = @{$info->{rest}} if exists($info->{rest});
- $self->get_user($info->{id}, @rest);
- };
- }
-
- ## a little cruft to stay compatible with some poorly written stores / credentials
- ## we'll remove this soon.
- if ($storeclass->can('new')) {
- $self->store($storeclass->new($config->{'store'}, $app, $self));
- } else {
- $app->log->error("THIS IS DEPRECATED: $storeclass has no new() method - Attempting to use uninstantiated");
- $self->store($storeclass);
- }
- if ($credentialclass->can('new')) {
- $self->credential($credentialclass->new($config->{'credential'}, $app, $self));
- } else {
- $app->log->error("THIS IS DEPRECATED: $credentialclass has no new() method - Attempting to use uninstantiated");
- $self->credential($credentialclass);
- }
-
- return $self;
-}
-
-sub find_user {
- my ( $self, $authinfo, $c ) = @_;
-
- my $res = $self->store->find_user($authinfo, $c);
-
- if (!$res) {
- if ($self->config->{'auto_create_user'} && $self->store->can('auto_create_user') ) {
- $res = $self->store->auto_create_user($authinfo, $c);
- }
- } elsif ($self->config->{'auto_update_user'} && $self->store->can('auto_update_user')) {
- $res = $self->store->auto_update_user($authinfo, $c, $res);
- }
-
- return $res;
-}
-
-sub authenticate {
- my ($self, $c, $authinfo) = @_;
-
- my $user = $self->credential->authenticate($c, $self, $authinfo);
- if (ref($user)) {
- $c->set_authenticated($user, $self->name);
- return $user;
- } else {
- return undef;
- }
-}
-
-sub save_user_in_session {
- my ( $self, $c, $user ) = @_;
-
- $c->session->{__user_realm} = $self->name;
-
- # we want to ask the store for a user prepared for the session.
- # but older modules split this functionality between the user and the
- # store. We try the store first. If not, we use the old method.
- if ($self->store->can('for_session')) {
- $c->session->{__user} = $self->store->for_session($c, $user);
- } else {
- $c->session->{__user} = $user->for_session;
- }
-}
-
-sub from_session {
- my ($self, $c, $frozen_user) = @_;
-
- return $self->store->from_session($c, $frozen_user);
-}
-
-
-__PACKAGE__;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-Catalyst::Plugin::Authentication::Realm - Base class for realm objects.
-
-=head1 DESCRIPTION
-
-=head1 CONFIGURATION
-
-=over 4
-
-=item class
-
-By default this class is the default realm class. You can specify a custom
-realm class with this config parameter.
-
-=item auto_create_user
-
-Set this to true if you wish this realm to auto-create user accounts when the
-user doesn't exist (most useful for remote authentication schemes).
-
-=item auto_update_user
-
-Set this to true if you wish this realm to auto-update user accounts after
-authentication (most useful for remote authentication schemes).
-
-=back
-
-=head1 METHODS
-
-=head2 new( )
-
-Instantiantes this realm, plus the specified store and credential classes.
-
-=head2 store( )
-
-Holds an instance of the store object for this realm.
-
-=head2 credential( )
-
-Holds an instance of the credential object for this realm.
-
-=head2 find_user( )
-
-Delegates to the store object. Will also re-delegate auto_create_user and
-auto_update_user at this time, if necessary.
-
-=head2 authenticate( )
-
-Delegates to the credential objects and sets the authenticated user on success.
-
-=head2 save_user_in_session( )
-
-Delegates to the store object.
-
-=head2 from_session( )
-
-Delegates to the store object.
-
-=cut
-
Added: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store/Minimal.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store/Minimal.pm (rev 0)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store/Minimal.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -0,0 +1,24 @@
+package Catalyst::Plugin::Authentication::Store::Minimal;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Authentication::Store::Minimal/;
+
+__PACKAGE__;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Catalyst::Plugin::Authentication::Store::Minimal - Compatibility shim
+
+=head1 DESCRIPTION
+
+THIS IS A COMPATIBILITY SHIM. It allows old configurations of Catalyst
+Authentication to work without code changes.
+
+Please see L<Catalyst::Authentication::Store::Minimal> for more information.
+
Deleted: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store.pod
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store.pod 2007-11-23 00:07:58 UTC (rev 7157)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/Store.pod 2007-11-23 06:23:14 UTC (rev 7158)
@@ -1,133 +0,0 @@
-
-=head1 NAME
-
-Catalyst::Plugin::Authentication::Store - All about authentication stores
-
-=head1 MULTIPLE BACKENDS
-
-B<NOTE> This is documentation for the old store system used in versions of
-L<Catalyst::Plugin::Authentication> prior to 0.10. This is NOT how the
-new realm-based stores work. This is here for reference only.
-
-See L<Catalyst::Plugin::Authentication::Internals> instead.
-
-=head1 OLD STORE DOCUMENTATION BELOW
-
-A key issue to understand about authentication stores is that there are
-potentially many of them. Each one is registered into the application, and has
-a name.
-
-For most applications, there is only one, and in this framework it is called
-'default'.
-
-When you use a plugin, like
-
- use Catalyst qw/
- Authentication
- Authentication::Store::Foo
- /;
-
-the Store plugins typically only act at setup time. They rarely do more than
-check out the configuration, and register e.g. Store::Foo, and set it
-as the default store.
-
- __PACKAGE__->default_auth_store( $store );
-
- # the same as
-
- __PACKAGE__->register_auth_stores( default => $store );
-
-=head1 WORKING WITH USERS
-
-All credential verifiers should accept either a user object, or a user ID.
-
-If a user ID is provided, then they will fetch the user object from the default
-store, and check against it.
-
-This should be pretty much DWIM all the time.
-
-When you need multiple authentication backends per application then you must
-fetch things yourself. For example:
-
- my $user = $c->get_auth_store("other_store")->get_user($id);
-
- $c->login( $user, $supplied_password );
-
-Instead of just:
-
- $c->login( $id, $supplied_password );
-
-which will go to the default store.
-
-=head1 WRITING A BACKEND
-
-Writing an authentication storage backend is a very simple matter.
-
-The only method you really need to support is C<get_user>.
-
-This method should accept an arbitrary list of parameters (determined by you or
-the credential verifyer), and return an object inheriting
-L<Catalyst::Plugin::Authentication::User>.
-
-For introspection purposes you can also define the C<user_supports> method. See
-below for optional features. This is not necessary, but might be in the future.
-
-=head2 Integrating with Catalyst::Plugin::Session
-
-If your users support sessions, your store should also define the
-C<from_session> method. When the user object is saved in the session the
-C<for_session> method is called, and that is used as the value in the session
-(typically a user id). The store is also saved in the hash. If
-C<<$user->store>> returns something registered, that store's name is used. If
-not, the user's class is used as if it were a store (and must also support
-C<from_session>).
-
-=head2 Optional Features
-
-Each user has the C<supports> method. For example:
-
- $user->supports(qw/password clear/);
-
-should return a true value if this specific user has a clear text password.
-
-This is on a per user (not necessarily a per store) basis. To make assumptions
-about the store as a whole,
-
- $store->user_supports(qw/password clear/);
-
-is supposed to be the lowest common denominator.
-
-The standardization of these values is to be goverened by the community,
-typically defined by the credential verification plugins.
-
-=head2 Stores implying certain credentials
-
-Sometimes a store is agnostic to the credentials (DB storage, for example), but
-sometimes it isn't (like an Htpasswd file).
-
-If you are writing a backend that wraps around a module, like
-L<Catalyst::Plugin::Authentication::Store::Htpasswd> wraps around
-L<Authen::Htpasswd>, it makes sense to delegate the credential checks.
-
-This particular example caused the following "feature" to be added:
-
- $user->supports(qw/password self_check/);
-
-=head2 Writing a plugin to go with the backend
-
-Typically the backend will do the heavy lifting, by registering a store.
-
-These plugins should look something like this:
-
- sub setup {
- my $c = shift;
-
- $c->default_auth_store(
- # a store can be an object or a class
- Catalyst::Plugin::Authentication::Store::Foo::Backend->new(
- ...
- )
- );
-
- $c->NEXT::setup(@_);
- }
Deleted: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/User.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/User.pm 2007-11-23 00:07:58 UTC (rev 7157)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication/User.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -1,114 +0,0 @@
-package Catalyst::Plugin::Authentication::User;
-
-use strict;
-use warnings;
-use base qw/Class::Accessor::Fast/;
-
-## auth_realm is the realm this user came from.
-BEGIN {
- __PACKAGE__->mk_accessors(qw/auth_realm store/);
-}
-
-## THIS IS NOT A COMPLETE CLASS! it is intended to provide base functionality only.
-## translation - it won't work if you try to use it directly.
-
-## chances are you want to override this.
-sub id { shift->get('id'); }
-
-## this relies on 'supported_features' being implemented by the subclass..
-## but it is not an error if it is not. it just means you support nothing.
-## nihilist user objects are welcome here.
-sub supports {
- my ( $self, @spec ) = @_;
-
- my $cursor = undef;
- if ($self->can('supported_features')) {
- $cursor = $self->supported_features;
-
- # traverse the feature list,
- for (@spec) {
- #die "bad feature spec: @spec" if ref($cursor) ne "HASH";
- return if ref($cursor) ne "HASH";
-
- $cursor = $cursor->{$_};
- }
- }
-
- return $cursor;
-}
-
-## REQUIRED.
-## get should return the value of the field specified as it's single argument from the underlying
-## user object. This is here to provide a simple, standard way of accessing individual elements of a user
-## object - ensuring no overlap between C::P::A::User methods and actual fieldnames.
-## this is not the most effecient method, since it uses introspection. If you have an underlying object
-## you most likely want to write this yourself.
-sub get {
- my ($self, $field) = @_;
-
- my $object;
- if ($object = $self->get_object and $object->can($field)) {
- return $object->$field();
- } else {
- return undef;
- }
-}
-
-## REQUIRED.
-## get_object should return the underlying user object. This is for when more advanced uses of the
-## user is required. Modifications to the existing user, etc. Changes in the object returned
-## by this routine may not be reflected in the C::P::A::User object - if this is required, re-authenticating
-## the user is probably the best route to take.
-## note that it is perfectly acceptable to return $self in cases where there is no underlying object.
-sub get_object {
- return shift;
-}
-
-## Backwards Compatibility
-## you probably want auth_realm, in fact. but this does work for backwards compatibility.
-## store should be a read-write accessor - so it was moved to mk_accessors
-##sub store {
-## my ($self) = @_;
-## return $self->auth_realm->{store};
-##}
-
-__PACKAGE__;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-Catalyst::Plugin::Authentication::User - Base class for user objects.
-
-=head1 SYNOPSIS
-
- package MyStore::User;
- use base qw/Catalyst::Plugin::Authentication::User/;
-
-=head1 DESCRIPTION
-
-This is the base class for authenticated
-
-=head1 METHODS
-
-=head2 id( )
-
-A unique ID by which a user can be retrieved from the store.
-
-=head2 store( )
-
-Should return a class name that can be used to refetch the user using it's
-ID.
-
-=head2 supports( )
-
-An introspection method used to determine what features a user object has, to support credential and authorization plugins.
-
-=head2 get( )
-
-=head2 get_object( )
-
-=cut
-
Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm 2007-11-23 00:07:58 UTC (rev 7157)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -11,7 +11,7 @@
use Tie::RefHash;
use Class::Inspector;
-use Catalyst::Plugin::Authentication::Realm;
+use Catalyst::Authentication::Realm;
# this optimization breaks under Template::Toolkit
# use user_exists instead
@@ -221,9 +221,9 @@
my $realmclass = $config->{class};
if( !$realmclass ) {
- $realmclass = 'Catalyst::Plugin::Authentication::Realm';
+ $realmclass = 'Catalyst::Authentication::Realm';
} elsif ($realmclass !~ /^\+(.*)$/ ) {
- $realmclass = "Catalyst::Plugin::Authentication::Realm::${realmclass}";
+ $realmclass = "Catalyst::Authentication::Realm::${realmclass}";
} else {
$realmclass = $1;
}
@@ -611,7 +611,7 @@
user, it must have come from the realm specified.)
The above example is somewhat similar to role based access control.
-L<Catalyst::Plugin::Authentication::Store::Minimal> treats the roles field as
+L<Catalyst::Authentication::Store::Minimal> treats the roles field as
an array of role names. Let's leverage this. Add the role authorization
plugin:
@@ -713,7 +713,7 @@
name, which is used to reference the realm, a credential and a store.
You can also specify as realm class to instantiate instead of the default
-L<Catalyst::Plugin::Authentication::Realm> class.
+L<Catalyst::Authentication::Realm> class.
Each realm config contains two hashes, one called 'credential' and one called
'store', each of which provide configuration details to the respective modules.
@@ -725,9 +725,9 @@
specification. If a class is prefixed with a +, it is assumed to be a complete
class name. Otherwise it is considered to be a portion of the class name. For
credentials, the classname 'B<Password>', for example, is expanded to
-Catalyst::Plugin::Authentication::Credential::B<Password>. For stores, the
+Catalyst::Authentication::Credential::B<Password>. For stores, the
classname 'B<storename>' is expanded to:
-Catalyst::Plugin::Authentication::Store::B<storename>.
+Catalyst::Authentication::Store::B<storename>.
=back
@@ -806,16 +806,16 @@
=head2 Realms
-L<Catalyst::Plugin::Authentication::Realm>
+L<Catalyst::Authentication::Realm>
=head2 User Storage Backends
-L<Catalyst::Plugin::Authentication::Store::Minimal>,
-L<Catalyst::Plugin::Authentication::Store::DBIx::Class>,
+L<Catalyst::Authentication::Store::Minimal>,
+L<Catalyst::Authentication::Store::DBIx::Class>,
=head2 Credential verification
-L<Catalyst::Plugin::Authentication::Credential::Password>,
+L<Catalyst::Authentication::Credential::Password>,
=head2 Authorization
Modified: trunk/Catalyst-Plugin-Authentication/t/05_password.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication/t/05_password.t 2007-11-23 00:07:58 UTC (rev 7157)
+++ trunk/Catalyst-Plugin-Authentication/t/05_password.t 2007-11-23 06:23:14 UTC (rev 7158)
@@ -4,7 +4,7 @@
use Test::More 'no_plan';
-my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Authentication::Credential::Password") }
+my $m; BEGIN { use_ok($m = "Catalyst::Authentication::Credential::Password") }
can_ok($m, "login");
Modified: trunk/Catalyst-Plugin-Authentication/t/06_user.t
===================================================================
--- trunk/Catalyst-Plugin-Authentication/t/06_user.t 2007-11-23 00:07:58 UTC (rev 7157)
+++ trunk/Catalyst-Plugin-Authentication/t/06_user.t 2007-11-23 06:23:14 UTC (rev 7158)
@@ -4,7 +4,7 @@
use Test::More tests => 6;
use Test::Exception;
-my $m; BEGIN { use_ok($m = "Catalyst::Plugin::Authentication::User") }
+my $m; BEGIN { use_ok($m = "Catalyst::Authentication::User") }
{
package SomeUser;
Modified: trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm 2007-11-23 00:07:58 UTC (rev 7157)
+++ trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm 2007-11-23 06:23:14 UTC (rev 7158)
@@ -1,5 +1,5 @@
package User::SessionRestoring;
-use base qw/Catalyst::Plugin::Authentication::User::Hash/;
+use base qw/Catalyst::Authentication::User::Hash/;
sub for_session { $_[0]->id }
sub store { $_[0]->{store} }
More information about the Catalyst-commits
mailing list