X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FAuthentication%2FCredential%2FPassword.pm;h=624143b7bd911a788dabd31cac6349bef53d5e3c;hb=646ea5b1aa19c86dda9cc98a62b656e7005c553f;hp=77b1129d0de5777f767e4350422a8a0a6a7a7724;hpb=8d0e04d07fa7435dd30a53586663246dc4fc4fd8;p=catagits%2FCatalyst-Plugin-Authentication.git diff --git a/lib/Catalyst/Plugin/Authentication/Credential/Password.pm b/lib/Catalyst/Plugin/Authentication/Credential/Password.pm index 77b1129..624143b 100644 --- a/lib/Catalyst/Plugin/Authentication/Credential/Password.pm +++ b/lib/Catalyst/Plugin/Authentication/Credential/Password.pm @@ -9,15 +9,17 @@ use Catalyst::Exception (); use Digest (); BEGIN { - __PACKAGE__->mk_accessors(qw/_config/); + __PACKAGE__->mk_accessors(qw/_config realm/); } sub new { - my ($class, $config, $app) = @_; + my ($class, $config, $app, $realm) = @_; my $self = { _config => $config }; bless $self, $class; + $self->realm($realm); + $self->_config->{'password_field'} ||= 'password'; $self->_config->{'password_type'} ||= 'clear'; $self->_config->{'password_hash_type'} ||= 'SHA-1'; @@ -30,7 +32,7 @@ sub new { } sub authenticate { - my ( $self, $c, $authstore, $authinfo ) = @_; + my ( $self, $c, $realm, $authinfo ) = @_; ## because passwords may be in a hashed format, we have to make sure that we remove the ## password_field before we pass it to the user routine, as some auth modules use @@ -38,7 +40,7 @@ sub authenticate { my $userfindauthinfo = {%{$authinfo}}; delete($userfindauthinfo->{$self->_config->{'password_field'}}); - my $user_obj = $authstore->find_user($userfindauthinfo, $c); + my $user_obj = $realm->find_user($userfindauthinfo, $c); if (ref($user_obj)) { if ($self->check_password($user_obj, $authinfo)) { return $user_obj;