Checking in changes prior to tagging of version 1.002. Changelog diff is: v1.002
Tomas Doran [Thu, 2 Oct 2008 08:23:21 +0000 (08:23 +0000)]
=== Changes
==================================================================
--- Changes (revision 7836)
+++ Changes (local)
@@ -1,6 +1,7 @@
-1.002  ??? Oct   ?? ??:??:?? GMT 2008
   - Add Test::WWW::Mechanize::Catalyst to build_requires.
     CPANTs will keep hitting me until I get it right :(
+1.002  Thu Oct   02 09:20:30 GMT 2008
+    - Add Test::WWW::Mechanize::Catalyst and Test::use::ok
+      to build_requires. CPANTs will keep hitting me until
+      I get it right :(
Add code and docs for user_field configuration option
Add code and docs for user_class configuration option

Changes
Makefile.PL
Todo
lib/Catalyst/Authentication/Store/Htpasswd.pm
lib/Catalyst/Authentication/Store/Htpasswd/User.pm
t/backend.t

diff --git a/Changes b/Changes
index d00ae07..81ceb4f 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,6 +1,7 @@
-1.002  ??? Oct   ?? ??:??:?? GMT 2008
-    - Add Test::WWW::Mechanize::Catalyst to build_requires.
-      CPANTs will keep hitting me until I get it right :(
+1.002  Thu Oct   02 09:20:30 GMT 2008
+    - Add Test::WWW::Mechanize::Catalyst and Test::use::ok
+      to build_requires. CPANTs will keep hitting me until 
+      I get it right :(
     - Add code and docs for user_field configuration option
     - Add code and docs for user_class configuration option
 
index 0587d2f..8aa32c8 100644 (file)
@@ -9,5 +9,6 @@ requires 'Authen::Htpasswd' => '0.13';
 requires 'Class::Accessor::Fast';
 requires 'Crypt::PasswdMD5';
 build_requires 'Test::WWW::Mechanize::Catalyst';
+build_requires 'Test::use::ok';
 
 WriteAll;  
diff --git a/Todo b/Todo
index 98e7cad..77d0117 100644 (file)
--- a/Todo
+++ b/Todo
@@ -2,4 +2,6 @@
 . Better docs
 . Test configurable user class
 . Test configurable username field.
-. Configurable password field.
\ No newline at end of file
+. Configurable password field.
+. Test autoload
+. Test stringification
index 532f323..5fecc4a 100644 (file)
@@ -9,7 +9,7 @@ use Authen::Htpasswd;
 use Catalyst::Authentication::Store::Htpasswd::User;
 use Scalar::Util qw/blessed/;
 
-our $VERSION = '1.001';
+our $VERSION = '1.002';
 
 BEGIN { __PACKAGE__->mk_accessors(qw/file user_field user_class/) }
 
@@ -93,7 +93,7 @@ user storage/authentication.
 
 =head1 DESCRIPTION
 
-This plugin uses C<Authen::Htpasswd> to let your application use C<.htpasswd>
+This plugin uses L<Authen::Htpasswd> to let your application use C<<.htpasswd>>
 files for it's authentication storage.
 
 =head1 METHODS
@@ -112,7 +112,7 @@ Delegates to L<Catalyst::Authentication::Store::Htpasswd::User->user_supports|Ca
 
 =head2 from_session
 
-Delegates the user lookup to C< find_user >
+Delegates the user lookup to C<< find_user >>
 
 =head1 CONFIGURATION
 
@@ -133,7 +133,7 @@ needed.
 
 =head2 user_field
 
-Change the field that the username is found in in the information passed into the call to C< $c->authenticate() >.
+Change the field that the username is found in in the information passed into the call to C<< $c->authenticate() >>.
 
 This defaults to I< username >, and generally you should be able to use the module as shown in the synopsis, however
 if you need a different field name then this setting can change the default.
@@ -151,11 +151,11 @@ Example:
 
 =head1 AUTHORS
 
-Yuval Kogman C<nothingmuch@woobling.org>
+Yuval Kogman C<<nothingmuch@woobling.org>>
 
-David Kamholz C<dkamholz@cpan.org>
+David Kamholz C<<dkamholz@cpan.org>>
 
-Tomas Doran C<bobtfish@bobtfish.net>
+Tomas Doran C<<bobtfish@bobtfish.net>>
 
 =head1 SEE ALSO
 
index 0f3e42b..f0f3cbe 100644 (file)
@@ -6,7 +6,7 @@ use base qw/Catalyst::Authentication::User Class::Accessor::Fast/;
 use strict;
 use warnings;
 
-BEGIN { __PACKAGE__->mk_accessors(qw/user store/) }
+BEGIN { __PACKAGE__->mk_accessors(qw/_user _store/) }
 
 use overload '""' => sub { shift->id }, fallback => 1;
 
@@ -15,12 +15,12 @@ sub new {
 
        return unless $user;
 
-       bless { store => $store, user => $user }, $class;
+       bless { _store => $store, _user => $user }, $class;
 }
 
 sub id {
     my $self = shift;
-    return $self->user->username;
+    return $self->_user->username;
 }
 
 sub supported_features {
@@ -35,19 +35,18 @@ sub supported_features {
 
 sub check_password {
        my ( $self, $password ) = @_;
-       return $self->user->check_password( $password );
+       return $self->_user->check_password( $password );
 }
 
 sub roles {
        my $self = shift;
-       my $field = $self->user->extra_info->[0];
+       my $field = $self->_user->extra_info->[0];
        return defined $field ? split /,/, $field : ();
 }
 
-sub for_session {
-    my $self = shift;
-    return $self->id;
-}
+*for_session = \&id;
+
+*get_object = \&_user;
 
 sub AUTOLOAD {
        my $self = shift;
@@ -56,7 +55,7 @@ sub AUTOLOAD {
 
        return if $method eq "DESTROY";
        
-       $self->user->$method;
+       $self->_user->$method;
 }
 
 1;
@@ -106,6 +105,10 @@ Returns the username, which is then stored in the session.
 
 Returns data about which featurs this user module supports.
 
+=head2 get_object
+
+Returns the underlieing L<Authen::Htpasswd::User> object for this user
+
 =head1 AUTHORS
 
 Yuval Kogman C<nothingmuch@woobling.org>
index aa0f6e9..0b800a9 100644 (file)
@@ -36,11 +36,11 @@ ok( $u->check_password( "s3cr3t" ), "password is s3cr3t");
 
 ok( $m->user_supports(qw/session/), "user_supports session");
 
-is( $u->store, $o, "can get store");
+is( $u->_store, $o, "can get store");
 
 can_ok( $m, "from_session" );
 can_ok( $u, "for_session" );
 
-my $recovered = $u->store->from_session( undef, $u->for_session );
+my $recovered = $u->_store->from_session( undef, $u->for_session );
 
 is( $recovered->username, $u->username, "recovery from session works");