| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Catalyst
Revision: 8508
Author: t0m
Date: 06 Oct 2008 10:08:16
Changes:Add an extra field which I need
Files:| ... | ...@@ -13,11 +13,12 @@ | |
| 13 | 13 | __PACKAGE__->mk_accessors(qw/_config realm/); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | our $VERSION = "1.005"; | |
| 16 | our $VERSION = "1.006"; | |
| 17 | 17 | |
| 18 | 18 | sub new { |
| 19 | 19 | my ($class, $config, $app, $realm) = @_; |
| 20 | 20 | |
| 21 | $config->{username_field} ||= 'username'; | |
| 21 | 22 | my $self = { _config => $config, _debug => $app->debug }; |
| 22 | 23 | bless $self, $class; |
| 23 | 24 | |
| ... | ...@@ -58,7 +59,7 @@ | |
| 58 | 59 | my $headers = $c->req->headers; |
| 59 | 60 | |
| 60 | 61 | if ( my ( $username, $password ) = $headers->authorization_basic ) { |
| 61 | my $user_obj = $realm->find_user( { username => $username }, $c); | |
| 62 | my $user_obj = $realm->find_user( { $self->_config->{username_field} => $username }, $c); | |
| 62 | 63 | if (ref($user_obj)) { |
| 63 | 64 | if ($self->check_password($user_obj, {$self->_config->{password_field} => $password})) { |
| 64 | 65 | $c->set_authenticated($user_obj); |
| ... | ...@@ -125,7 +126,7 @@ | |
| 125 | 126 | my $user; |
| 126 | 127 | |
| 127 | 128 | unless ( $user = $auth_info->{user} ) { |
| 128 | $user = $realm->find_user( { username => $username }, $c); | |
| 129 | $user = $realm->find_user( { $self->_config->{username_field} => $username }, $c); | |
| 129 | 130 | } |
| 130 | 131 | unless ($user) { # no user, no authentication |
| 131 | 132 | $c->log->debug("Unable to locate user matching user info provided") if $c->debug; |
| ... | ...@@ -569,6 +570,10 @@ | |
| 569 | 570 | The name of accessor used to retrieve the value of the password field from the user object. Same usage as in |
| 570 | 571 | L<Catalyst::Authentication::Credential::Password|Catalyst::Authentication::Credential::Password/password_field> |
| 571 | 572 | |
| 573 | =item username_field | |
| 574 | ||
| 575 | The field name that the user's username is mapped into when finding the user from the realm. Defaults to 'username'. | |
| 576 | ||
| 572 | 577 | =item use_uri_for |
| 573 | 578 | |
| 574 | 579 | If this configuration key has a true value, then the domain(s) for the authorization header will be |
| ... | ...@@ -2,4 +2,6 @@ | |
| 2 | 2 | . Test 'algorithm' config / MD5-sess properly. |
| 3 | 3 | . Full implementation of MD5-sess with remote authentication service. |
| 4 | 4 | . Domain option should be able to be passed as config. |
| 5 | . Support for NTLM auth? | |
| 6 | 5 | \ No newline at end of file |
| 6 | . Support for NTLM auth? | |
| 7 | . Config verification / validation on construction. | |
| 8 | . Test all config parameters (esp username_field) | |
| 7 | 9 | \ No newline at end of file |
| ... | ...@@ -1,3 +1,7 @@ | |
| 1 | 1.006 2008-10-06 | |
| 2 | - Added username_field configuration option. I need this to play | |
| 3 | nice with Catalyst::Authentication::Store::Tangram. | |
| 4 | ||
| 1 | 5 | 1.005 2008-09-25 |
| 2 | 6 | - Added better description of the use of the domains and |
| 3 | 7 | use_uri_for options (info culled from RFC2617). |