doc updates
Brian Cassidy [Thu, 25 Oct 2007 16:14:43 +0000 (16:14 +0000)]
Changes
lib/Catalyst/Plugin/Authentication.pm
lib/Catalyst/Plugin/Authentication/Credential/Password.pm
lib/Catalyst/Plugin/Authentication/Realm.pm
lib/Catalyst/Plugin/Authentication/Realm/Compatibility.pm
lib/Catalyst/Plugin/Authentication/Store/Minimal.pm
lib/Catalyst/Plugin/Authentication/Store/Null.pm
lib/Catalyst/Plugin/Authentication/User.pm
lib/Catalyst/Plugin/Authentication/User/Hash.pm

diff --git a/Changes b/Changes
index 0704970..551df62 100644 (file)
--- a/Changes
+++ b/Changes
@@ -4,6 +4,12 @@ Revision history for Perl extension Catalyst::Plugin::Authentication
         - Added a "Null" store for credentials that don't require real stores.
         - Make realms bonafide objects
         - Added auto_update_user and auto_create_user options to the Realm object
+        - Doc updates
+
+        [POSSIBLE INCOMPATIBILITIES]
+        - authenticate() in credentials are now passed a realm object instead of
+          a store object. A realm object still implements find_user() so unless
+          you're doing something special you won't notice the difference.
 
 0.10002 2007-07-22
         - $user->store() should NOT be set by C::P::Auth - if it's needed - it
index f139712..e9addc1 100644 (file)
@@ -450,7 +450,8 @@ authentication, or it may be facilitated by a number of plugins.
 
 Configuration of the Catalyst::Plugin::Authentication framework is done in
 terms of realms. In simplest terms, a realm is a pairing of a Credential
-verifier and a User storage (Store) backend.
+verifier and a User storage (Store) backend. As of version 0.10003, realms are
+now objects that you can create and customize.
 
 An application can have any number of Realms, each of which operates
 independant of the others. Each realm has a name, which is used to identify it
@@ -704,6 +705,9 @@ This contains the series of realm configurations you want to use for your app.
 The only rule here is that there must be at least one.  A realm consists of a
 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.
+
 Each realm config contains two hashes, one called 'credential' and one called 
 'store', each of which provide configuration details to the respective modules.
 The contents of these hashes is specific to the module being used, with the 
@@ -718,25 +722,21 @@ Catalyst::Plugin::Authentication::Credential::B<Password>. For stores, the
 classname 'B<storename>' is expanded to:
 Catalyst::Plugin::Authentication::Store::B<storename>.
 
-
 =back
 
-
 =head1 METHODS
 
-=over 4 
-
-=item authenticate( $userinfo, $realm )
+=head2 authenticate( $userinfo, $realm )
 
 Attempts to authenticate the user using the information in the $userinfo hash
 reference using the realm $realm. $realm may be omitted, in which case the
 default realm is checked.
 
-=item user
+=head2 user( )
 
 Returns the currently logged in user or undef if there is none.
 
-=item user_exists
+=head2 user_exists( )
 
 Returns true if a user is logged in right now. The difference between
 user_exists and user is that user_exists will return true if a user is logged
@@ -744,22 +744,20 @@ in, even if it has not been yet retrieved from the storage backend. If you only
 need to know if the user is logged in, depending on the storage mechanism this
 can be much more efficient.
 
-=item user_in_realm ( $realm )
+=head2 user_in_realm( $realm )
 
 Works like user_exists, except that it only returns true if a user is both 
 logged in right now and was retrieved from the realm provided.  
 
-=item logout
+=head2 logout( )
 
 Logs the user out, Deletes the currently logged in user from $c->user and the session.
 
-=item find_user( $userinfo, $realm )
+=head2 find_user( $userinfo, $realm )
 
 Fetch a particular users details, matching the provided user info, from the realm 
 specified in $realm.
 
-=back
-
 =head1 INTERNAL METHODS
 
 These methods are for Catalyst::Plugin::Authentication B<INTERNAL USE> only.
@@ -768,43 +766,41 @@ store modules. If you do, you will very likely get the nasty shock of having
 to fix / rewrite your code when things change. They are documented here only
 for reference.
 
-=over 4
-
-=item set_authenticated ( $user, $realmname )
+=head2 set_authenticated( $user, $realmname )
 
 Marks a user as authenticated. This is called from within the authenticate
 routine when a credential returns a user. $realmname defaults to 'default'
 
-=item auth_restore_user ( $user, $realmname )
+=head2 auth_restore_user( $user, $realmname )
 
 Used to restore a user from the session. In most cases this is called without
 arguments to restore the user via the session. Can be called with arguments
 when restoring a user from some other method.  Currently not used in this way.
 
-=item save_user_in_session ( $user, $realmname )
+=head2 save_user_in_session( $user, $realmname )
 
 Used to save the user in a session. Saves $user in session, marked as
 originating in $realmname. Both arguments are required.
 
-=item auth_realms
+=head2 auth_realms( )
 
 Returns a hashref containing realmname -> realm instance pairs. Realm
 instances contain an instantiated store and credential object as the 'store'
 and 'credential' elements, respectively
 
-=item get_auth_realm ( $realmname )
+=head2 get_auth_realm( $realmname )
 
 Retrieves the realm instance for the realmname provided.
 
-=item 
-
-=back
-
 =head1 SEE ALSO
 
 This list might not be up to date.  Below are modules known to work with the updated
 API of 0.10 and are therefore compatible with realms.  
 
+=head2 Realms
+
+L<Catalyst::Plugin::Authentication::Realm>
+
 =head2 User Storage Backends
 
 L<Catalyst::Plugin::Authentication::Store::Minimal>,
@@ -872,16 +868,14 @@ These routines should not be used in any application using realms
 functionality or any of the methods described above. These are for reference
 purposes only.
 
-=over 4
-
-=item login
+=head2 login( )
 
 This method is used to initiate authentication and user retrieval. Technically
 this is part of the old Password credential module and it still resides in the
 L<Password|Catalyst::Plugin::Authentication::Credential::Password> class. It is
 included here for reference only.
 
-=item default_auth_store
+=head2 default_auth_store( )
 
 Return the store whose name is 'default'.
 
@@ -894,26 +888,22 @@ or by using a Store plugin:
 Sets the default store to
 L<Catalyst::Plugin::Authentication::Store::Minimal>.
 
-=item get_auth_store $name
+=head2 get_auth_store( $name )
 
 Return the store whose name is $name.
 
-=item get_auth_store_name $store
+=head2 get_auth_store_name( $store )
 
 Return the name of the store $store.
 
-=item auth_stores
+=head2 auth_stores( )
 
 A hash keyed by name, with the stores registered in the app.
 
-=item register_auth_stores %stores_by_name
+=head2 register_auth_stores( %stores_by_name )
 
 Register stores into the application.
 
-=back
-
-
-
 =head1 AUTHORS
 
 Yuval Kogman, C<nothingmuch@woobling.org>
@@ -924,7 +914,6 @@ Jess Robinson
 
 David Kamholz
 
-
 =head1 COPYRIGHT & LICENSE
 
         Copyright (c) 2005 the aforementioned authors. All rights
index 624143b..a0d76f0 100644 (file)
@@ -1,9 +1,10 @@
 package Catalyst::Plugin::Authentication::Credential::Password;
-use base qw/Class::Accessor::Fast/;
 
 use strict;
 use warnings;
 
+use base qw/Class::Accessor::Fast/;
+
 use Scalar::Util        ();
 use Catalyst::Exception ();
 use Digest              ();
@@ -358,9 +359,7 @@ There are no publicly exported routines in the Password module (or indeed in
 most credential modules.)  However, below is a description of the routines 
 required by L<Catalyst::Plugin::Authentication> for all credential modules.
 
-=over 4
-
-=item new ( $config, $app )
+=head2 new( $config, $app )
 
 Instantiate a new Password object using the configuration hash provided in
 $config. A reference to the application is provided as the second argument.
@@ -369,9 +368,9 @@ plugin setup phase, which is before the application specific controllers are
 loaded. The practical upshot of this is that things like $c->model(...) will
 not function as expected.
 
-=item authenticate ( $authinfo, $c )
+=head2 authenticate( $authinfo, $c )
 
 Try to log a user in, receives a hashref containing authentication information
 as the first argument, and the current context as the second.
 
-=back
+=cut
index 9b162f3..fbd7124 100644 (file)
@@ -144,22 +144,31 @@ Catalyst::Plugin::Authentication::Realm - Base class for realm objects.
 
 =head1 DESCRIPTION
 
-=head1 METHODS
+=head1 CONFIGURATION
 
 =over 4
 
-=item new
+=item class
+
+=item auto_create_user
 
-=item find_user
+=item auto_update_user
 
-=item authenticate
+=back
+
+=head1 METHODS
 
-=item save_user_in_session
+=head2 new( )
 
-=item from_session
+=head2 find_user( )
+
+=head2 authenticate( )
+
+=head2 save_user_in_session( )
+
+=head2 from_session( )
 
 =back
 
 =cut
 
-
index fcf12cf..0758fad 100644 (file)
@@ -35,12 +35,8 @@ An empty realm object for compatibility reasons.
 
 =head1 METHODS
 
-=over 4
-
-=item new
+=head2 new( )
 
 Returns a, basically empty, realm object.
 
-=back
-
 =cut
index e48a45f..2238e2a 100644 (file)
@@ -12,7 +12,7 @@ BEGIN {
 }
 
 sub new {
-    my ( $class, $config, $app) = @_;
+    my ( $class, $config, $app, $realm) = @_;
 
     bless { userhash => $config->{'users'} }, $class;
 }
@@ -189,14 +189,12 @@ There are no publicly exported routines in the Minimal store (or indeed in
 most authentication stores)  However, below is a description of the routines 
 required by L<Catalyst::Plugin::Authentication> for all authentication stores.
 
-=over 4
-
-=item new ( $config, $app )
+=head2 new( $config, $app, $realm )
 
 Constructs a new store object, which uses the user element of the supplied config 
 hash ref as it's backing structure.
 
-=item find_user ( $authinfo, $c ) 
+=head2 find_user( $authinfo, $c ) 
 
 Keys the hash by the 'id' or 'username' element in the authinfo hash and returns the user.
 
@@ -205,16 +203,14 @@ Keys the hash by the 'id' or 'username' element in the authinfo hash and returns
 If the return value is unblessed it will be blessed as
 L<Catalyst::Plugin::Authentication::User::Hash>.
 
-=item from_session $id
+=head2 from_session( $id )
 
 Delegates to C<get_user>.
 
-=item user_supports
+=head2 user_supports( )
 
 Chooses a random user from the hash and delegates to it.
 
-=back
-
 =cut
 
 
index 4c854c7..e49dd8c 100644 (file)
@@ -12,7 +12,7 @@ BEGIN {
 }
 
 sub new {
-    my ( $class, $config, $app) = @_;
+    my ( $class, $config, $app, $realm ) = @_;
     bless { _config => $config }, $class;
 }
 
index e2746eb..06830b7 100644 (file)
@@ -93,25 +93,18 @@ This is the base class for authenticated
 
 =head1 METHODS
 
-=over 4
-
-=item id
+=head2 id( )
 
 A unique ID by which a user can be retrieved from the store.
 
-=item store
+=head2 store( )
 
 Should return a class name that can be used to refetch the user using it's
 ID.
 
-=item supports
+=head2 supports( )
 
 An introspection method used to determine what features a user object has, to support credential and authorization plugins.
 
-=item 
-
-=back
-
 =cut
 
-
index 7f530a1..1c36e2b 100644 (file)
@@ -1,9 +1,10 @@
 package Catalyst::Plugin::Authentication::User::Hash;
-use base qw/Catalyst::Plugin::Authentication::User/;
 
 use strict;
 use warnings;
 
+use base qw/Catalyst::Plugin::Authentication::User/;
+
 sub new {
     my $class = shift;
 
@@ -123,36 +124,32 @@ hand with L<Catalyst::Plugin::Authentication::Store::Minimal>.
 
 =head1 METHODS
 
-=over 4
-
-=item new @pairs
+=head2 new( @pairs )
 
 Create a new object with the key-value-pairs listed in the arg list.
 
-=item supports
+=head2 supports( )
 
 Checks for existence of keys that correspond with features.
 
-=item for_session
+=head2 for_session( )
 
 Just returns $self, expecting it to be serializable.
 
-=item from_session
+=head2 from_session( )
 
 Just passes returns the unserialized object, hoping it's intact.
 
-=item AUTOLOAD
+=head2 AUTOLOAD( )
 
 Accessor for the key whose name is the method.
 
-=item id
+=head2 id( )
 
-=item store
+=head2 store( )
 
 Accessors that override superclass's dying virtual methods.
 
-=back
-
 =head1 SEE ALSO
 
 L<Hash::AsObject>