From: David Kamholz Date: Thu, 10 Nov 2005 21:17:37 +0000 (+0000) Subject: Authentication::Store::Htpasswd: X-Git-Tag: v0.02~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Authentication-Store-Htpasswd.git;a=commitdiff_plain;h=47fb088eac2f983f623062ce393a6840b4ac621e Authentication::Store::Htpasswd: overload stringify to username passthrough for session login --- diff --git a/lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm b/lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm index b5efe7c..7c7600f 100644 --- a/lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm +++ b/lib/Catalyst/Plugin/Authentication/Store/Htpasswd/User.pm @@ -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__