[Catalyst] Stupid error with C::Authentication
Alex Povolotsky
tarkhil at over.ru
Mon Aug 26 16:07:51 GMT 2013
Hello
In a quite simple application
__PACKAGE__->config('Plugin::Authentication' =>
{
default_realm => 'members',
realms => {
members => {
credential => {
class =>
'+Admin::Util::OldPassword',
password_field => 'password',
password_type => 'self_check',
},
store => {
class =>
'DBIx::Class',
user_model =>
'DB::InfEmployeeTab',
}
}
}
});
Later, in Controller::Root
$c->authenticate( { login => 'login', password => 'password' } );
(I'm just checking if everything is wired properly)
I get
[error] Caught exception in Admin::Controller::Root->index "Can't use
string ("Catalyst::Authentication::Store:"...) as a HASH ref while
"strict refs" in use at accessor
Catalyst::Authentication::Store::DBIx::Class::User::_user (defined at
/usr/local/lib/perl5/site_perl/5.14/Catalyst/Authentication/Store/DBIx/Class/User.pm
line 12) line 5, <DATA> line 1003."
My password class has nothing to get wrong, and replacing it with
default C::A::Credential::Password does not change anything
running under perl -d , script works just fine. Running without debug
mode, it does not even reach my module.
I have no idea where to look next.
Here is debug output
Caught exception in Admin::Controller::Root->index "Can't use string
("Catalyst::Authentication::Store:"...) as a HASH ref while "strict
refs" in use at accessor
Catalyst::Authentication::Store::DBIx::Class::User::_user (defined at
/usr/local/lib/perl5/site_perl/5.14/Catalyst/Authentication/Store/DBIx/Class/User.pm
line 12) line 5, <DATA> line 1003."
Request
do {
require Symbol;
my $a = bless({
_log => bless({
_body => "[info] *** Request 1 (0.333/s)
[19146] [Mon Aug 26 19:44:43 2013] ***\n[debug] Path is \"/\"\n[debug]
\"GET\" request for \"/\" from \"195.170.223.197\"\n[error] Caught
exception in Admin::Controller::Root->index \"Can't use string
(\"Catalyst::Authentication::Store:\"...) as a HASH ref while \"strict
refs\" in use at accessor
Catalyst::Authentication::Store::DBIx::Class::User::_user (defined at
/usr/local/lib/perl5/site_perl/5.14/Catalyst/Authentication/Store/DBIx/Class/User.pm
line 12) line 5, <DATA> line 1003.\"\n",
_psgi_errors => *main::STDERR,
level => 31,
}, "Catalyst::Log"),
_path => "",
_read_length => 0,
_read_position => 0,
action => "/",
address => "195.170.223.197",
arguments => [],
base => bless(do{\(my $o =
"http://corp.infotel.ru:3000/")}, "URI::http"),
body_parameters => {},
captures => [],
cookies => {
admin_session => bless({
name => "admin_session",
path => "/",
value =>
["ecf2b994cddc2aa02145005778961e5a06774b3b"],
}, "CGI::Simple::Cookie"),
e37551640d343da16a59042e6370102e => bless({
name => "e37551640d343da16a59042e6370102e",
path => "/",
value => ["jac13b5c06jqd96vn57dbjpgh6"],
}, "CGI::Simple::Cookie"),
PHPSESSID => bless({
name => "PHPSESSID",
path => "/",
value => ["meutdakp8mgf9to12iaq01dkh3"],
}, "CGI::Simple::Cookie"),
},
env => {
"HTTP_ACCEPT" =>
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"HTTP_ACCEPT_ENCODING" => "gzip,deflate,sdch",
"HTTP_ACCEPT_LANGUAGE" =>
"en-US,en;q=0.8,ru;q=0.6",
"HTTP_CACHE_CONTROL" => "max-age=0",
"HTTP_CONNECTION" => "keep-alive",
"HTTP_COOKIE" =>
"e37551640d343da16a59042e6370102e=jac13b5c06jqd96vn57dbjpgh6;
PHPSESSID=meutdakp8mgf9to12iaq01dkh3;
admin_session=ecf2b994cddc2aa02145005778961e5a06774b3b",
"HTTP_HOST" => "corp.infotel.ru:3000",
"HTTP_PRAGMA" => "no-cache",
"HTTP_USER_AGENT" => "Mozilla/5.0 (X11;
FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/27.0.1453.81 Safari/537.36",
"PATH_INFO" => "/",
"psgi.errors" => *main::STDERR,
"psgi.input" =>
\*HTTP::Server::PSGI::$input,
"psgi.multiprocess" => "",
"psgi.multithread" => "",
"psgi.nonblocking" => "",
"psgi.run_once" => "",
"psgi.streaming" => 1,
"psgi.url_scheme" => "http",
"psgi.version" => [1, 1],
"psgix.harakiri" => 1,
"psgix.input.buffered" => 1,
"psgix.io" =>
bless(Symbol::gensym(), "IO::Socket::INET"),
"QUERY_STRING" => "",
"REMOTE_ADDR" => "195.170.223.197",
"REMOTE_PORT" => 35202,
"REQUEST_METHOD" => "GET",
"REQUEST_URI" => "/",
"SCRIPT_NAME" => "",
"SERVER_NAME" => 0,
"SERVER_PORT" => 3000,
"SERVER_PROTOCOL" => "HTTP/1.1",
},
headers => bless({
"::std_case" => { cookie => "COOKIE" },
"accept" =>
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"accept-encoding" => "gzip,deflate,sdch",
"accept-language" => "en-US,en;q=0.8,ru;q=0.6",
"cache-control" => "max-age=0",
"connection" => "keep-alive",
"cookie" =>
"e37551640d343da16a59042e6370102e=jac13b5c06jqd96vn57dbjpgh6;
PHPSESSID=meutdakp8mgf9to12iaq01dkh3;
admin_session=ecf2b994cddc2aa02145005778961e5a06774b3b",
"host" => "corp.infotel.ru:3000",
"pragma" => "no-cache",
"user-agent" => "Mozilla/5.0 (X11;
FreeBSD amd64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/27.0.1453.81 Safari/537.36",
}, "HTTP::Headers"),
match => "/",
method => "GET",
parameters => {},
protocol => "HTTP/1.1",
query_keywords => "",
query_parameters => {},
remote_user => undef,
secure => 0,
uploads => {},
uri => bless(do{\(my $o =
"http://corp.infotel.ru:3000/")}, "URI::http"),
}, "Catalyst::Request");
*{$a->{env}{"psgix.io"}} = {
io_socket_peername => pack("H*","10028982c3aadfc50000000000000000"),
io_socket_timeout => undef,
};
$a;
}
Response
bless({
_log => bless({
_body => "[info] *** Request 1 (0.333/s) [19146] [Mon Aug 26
19:44:43 2013] ***\n[debug] Path is \"/\"\n[debug] \"GET\" request for
\"/\" from \"195.170.223.197\"\n[error] Caught exception in
Admin::Controller::Root->index \"Can't use string
(\"Catalyst::Authentication::Store:\"...) as a HASH ref while \"strict
refs\" in use at accessor
Catalyst::Authentication::Store::DBIx::Class::User::_user (defined at
/usr/local/lib/perl5/site_perl/5.14/Catalyst/Authentication/Store/DBIx/Class/User.pm
line 12) line 5, <DATA> line 1003.\"\n",
_psgi_errors => *main::STDERR,
level => 31,
}, "Catalyst::Log"),
_response_cb => sub { ... },
body => undef,
cookies => {},
finalized_headers => 0,
headers => bless({
"::std_case" => { "x-catalyst" => "X-Catalyst" },
"content-type" => "text/html; charset=utf-8",
"x-catalyst" => "5.90040",
}, "HTTP::Headers"),
status => 200,
}, "Catalyst::Response")
Stash
{}
Config
do {
my $a = {
"Action::RenderView" => {
ignore_classes => [
"DBIx::Class::ResultSource::Table",
"DBIx::Class::ResultSourceHandle",
"DateTime",
],
scrubber_func => sub { ... },
},
"default_view" => "HTML",
"disable_component_resolution_regex_fallback" => 1,
"enable_catalyst_header" => 1,
"home" => "/home/tarkhil/work/Admin",
"name" => "Admin",
"Plugin::Authentication" => {
default_realm => "members",
realms => {
members => {
credential => {
class => "+Admin::Util::OldPassword",
password_field => "password",
password_hash_type => "SHA-1",
password_type => "self_check",
},
store => {
class => "DBIx::Class",
id_field => ["login"],
ignore_fields_in_find => [],
lazyload => 0,
store_user_class =>
"Catalyst::Authentication::Store::DBIx::Class::User",
user_model => "DB::InfEmployeeTab",
},
use_session => 1,
},
},
use_session => 1,
},
"Plugin::ConfigLoader" => {},
"Plugin::Session" => {
cookie_name => "admin_session",
expires => 7200,
storage => "/tmp/admin/session_data",
verify_address => 0,
verify_user_agent => 0,
},
"Plugin::Static::Simple" => {
debug => 1,
dirs => [],
ignore_dirs => [],
ignore_extensions => ["tmpl", "tt", "tt2", "html", "xhtml"],
include_path => [
bless({
dirs => ["", "home", "tarkhil", "work", "Admin", "root"],
file_spec_class => undef,
volume => "",
}, "Path::Class::Dir"),
],
mime_types => {},
mime_types_obj => bless({}, "MIME::Types"),
no_logs => 1,
},
"root" => 'fix',
"static" => 'fix',
};
$a->{"root"} = $a->{"Plugin::Static::Simple"}{include_path}[0];
$a->{"static"} = $a->{"Plugin::Static::Simple"};
$a;
}
More information about the Catalyst
mailing list