我创建了一个简单的催化剂应用程序,并通过cpan文档添加了ACL授权。 像
这样的代码use Catalyst qw/
-Debug
ConfigLoader
Static::Simple
Authentication
Authorization::Roles
Authorization::ACL
/;
extends 'Catalyst';
# Start the application
__PACKAGE__->setup();
__PACKAGE__->deny_access_unless_any('/manage/test', [qw/Manager/]);
__PACKAGE__->deny_access_unless_any('/manage/test1', [qw/user/]);
在服务器日志中显示
[debug] Adding ACL rule from /home/test_apps/acltest/script/../lib/acltest.pm line 51 to the action /manage/test with sort index 0
[debug] Adding ACL rule from /home/test_apps/acltest/script/../lib/acltest.pm line 52 to all the actions under /manage/test1
[debug] ... manage/test1/index at sort index 1
[info] *** Request 1 (0.000/s) [7134] [Wed Feb 26 04:14:02 2014] ***
[debug] Path is "manage/test1"
[debug] "GET" request for "manage/test1" from "192.168.12.1"
[debug] running ACL rule CODE(0x5072c48) defined at /home/test_apps/acltest/script/../lib/acltest.pm line 52 on manage/test1/index
[error] Caught exception in ->ACL error rethrower "Access to manage/test1/index denied by rule CODE(0x5072c48) (defined at /home/test_apps/acltest/script/../lib/acltest.pm line 52)."
但我创建了另一个应用程序,它为应用程序中的特定用户维护会话并使用身份验证。我在此应用程序中添加了相同的ACL规则,但在服务器日志中
[debug] Adding ACL rule from /home/acl/script/../lib/acl.pm line 150 to the action /manage/tests with sort index 0
[debug] Adding ACL rule from /home/acl/script/../lib/acl.pm line 151 to the action /manage/tests/new with sort index 0
[info] *** Request 1 (0.002/s) [8454] [Wed Feb 26 03:59:45 2014] ***
[debug] Path is "manage/tests/new"
[debug] "GET" request for "manage/test/new" from "192.168.12.1"
[debug] Found sessionid "oBkt8U6jF3ZebLVlnbekFZQ7tgA/oGhR7ars4bEPNc-IQ-lH1vehqDk" in cookie
在上面的日志中,似乎ACL没有运行
任何想法将不胜感激。在此先感谢。