Adding 'None' option to password_type - allowing 'retrieve only' authentication
Matt S Trout [Tue, 17 Jul 2007 16:59:13 +0000 (16:59 +0000)]
r42000@cain (orig r6285):  jayk | 2007-04-14 03:10:47 +0000

lib/Catalyst/Plugin/Authentication/Credential/Password.pm

index 081dca7..0baa52e 100644 (file)
@@ -60,9 +60,11 @@ sub check_password {
         my $password = $authinfo->{$self->_config->{'password_field'}};
         my $storedpassword = $user->get($self->_config->{'password_field'});
         
-        if ($self->_config->{password_type} eq 'clear') {
+        if ($self->_config->{'password_type'} eq 'none') {
+            return 1;
+        } elsif ($self->_config->{'password_type'} eq 'clear') {
             return $password eq $storedpassword;
-        }  elsif ($self->_config->{'password_type'} eq 'crypted') {            
+        } elsif ($self->_config->{'password_type'} eq 'crypted') {            
             return $storedpassword eq crypt( $password, $storedpassword );
         } elsif ($self->_config->{'password_type'} eq 'salted_hash') {
             require Crypt::SaltedHash;
@@ -283,6 +285,12 @@ from the user object. The supported options are:
 
 =over 8
 
+=item none
+
+No password check is done. An attempt is made to retrieve the user based on
+the information provided in the $c->authenticate() call. If a user is found, 
+authentication is considered to be successful.
+
 =item clear
 
 The password in user is in clear text and will be compared directly.