use base 'Class::Accessor::Fast';
BEGIN {
- __PACKAGE__->mk_accessors(qw/allow_re deny_re cutname_re source realm/);
+ __PACKAGE__->mk_accessors(
+ qw/allow_re deny_re cutname_re source realm username_field/);
}
sub new {
my $self = { };
bless $self, $class;
-
+
# we are gonna compile regular expresions defined in config parameters
# and explicitly throw an exception saying what parameter was invalid
if (defined($config->{allow_regexp}) && ($config->{allow_regexp} ne "")) {
}
$self->source($config->{source} || 'REMOTE_USER');
$self->realm($realm);
+ $self->username_field($config->{username_field} || 'username');
return $self;
}
$usr = $1;
}
}
-
- $authinfo->{id} = $authinfo->{username} = $usr;
- $authinfo->{remote_user} = $remuser; # just to keep the original value
+
+ $authinfo->{ $self->username_field } = $usr;
my $user_obj = $realm->find_user( $authinfo, $c );
return ref($user_obj) ? $user_obj : undef;
}
match cutname_regexp at all or if '$1' regexp substring is empty we pass the
original WEBUSER value (without cutting) to Catalyst application.
+=head2 username_field
+
+This config item is B<OPTIONAL> - default is I<username>
+
+The key name in the authinfo hash that the user's username is mapped into.
+This is useful for using a store which requires a specific unusual field name
+for the username. The username is additionally mapped onto the I<id> key.
+
=head1 METHODS
=head2 new ( $config, $app, $realm )