Authentication::Store::Htpasswd:
David Kamholz [Thu, 10 Nov 2005 21:17:37 +0000 (21:17 +0000)]
overload stringify to username
passthrough for session login

lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm

index b5efe7c..7c7600f 100644 (file)
@@ -8,6 +8,8 @@ use warnings;
 
 BEGIN { __PACKAGE__->mk_accessors(qw/user/) }
 
+use overload '""' => sub { shift->user->username };
+
 sub new {
        my ( $class, $user ) = @_;
 
@@ -18,7 +20,8 @@ sub supported_features {
        return {
                password => {
                        self_check => 1,
-               }
+               },
+               session => 1
        };
 }
 
@@ -33,6 +36,16 @@ sub roles {
        split( ",", $self->user->extra_info );
 }
 
+sub for_session {
+    my $self = shift;
+    return $self;
+}
+
+sub from_session {
+    my ($class,$c,$user) = @_;
+    return $user;
+}
+
 __PACKAGE__;
 
 __END__