[英]Problems with security.yml on symfony
我正在嘗試使用sfGuardPlugin 5.0.0在Symfony 1.4上開發的應用程序中配置一些安全性。
要求說,管理員用戶可以做所有事情,而查看者只能列出和查看記錄。
這是我在模塊的目錄配置中使用的security.yml:
index:
is_secure: true
credentials: [[ admin, viewer ]]
show:
is_secure: true
credentials: [[ admin, viewer ]]
all:
is_secure: true
credentials: [ admin ]
但是我不知道為什么當我嘗試進行允許查看器執行的操作之一時,它以消息“不允許”停止。
這是堆棧跟蹤:
1 sfPatternRouting Connect sfRoute "sf_guard_signin" (/guard/login)
2 sfPatternRouting Connect sfRoute "sf_guard_signout" (/guard/logout)
3 sfPatternRouting Match route "homepage" (/) for / with parameters
array ( 'module' => 'strain', 'action' => 'index',)
4 sfFilterChain Executing filter "sfRenderingFilter"
5 sfFilterChain Executing filter "sfBasicSecurityFilter"
6 Doctrine_Connection_Mysql exec : SET NAMES 'UTF8' - ()
7 Doctrine_Connection_Statement execute : SELECT s.id AS s__id, s.first_name AS
s__first_name, s.last_name AS s__last_name, s.email_address AS s__email_address, s.username
AS s__username, s.algorithm AS s__algorithm, s.salt AS s__salt, s.password AS s__password,
s.is_active AS s__is_active, s.is_super_admin AS s__is_super_admin, s.last_login AS
s__last_login, s.avatar AS s__avatar, s.token AS s__token, s.notify_new_order AS
s__notify_new_order, s.notify_ready_order AS s__notify_ready_order, s.initials AS
s__initials, s.created_at AS s__created_at, s.updated_at AS s__updated_at FROM sf_guard_user
s WHERE (s.id = ?) LIMIT 1 - (25)
8 sfBasicSecurityFilter Action "strain/index" requires credentials
"[admin, viewer]", forwarding to "sfGuardAuth/secure"
9 sfFilterChain Executing filter "sfRenderingFilter"
10 sfFilterChain Executing filter "InboxFilter"
11 Doctrine_Connection_Statement execute : DELETE FROM notification WHERE
(status = ? AND updated_at < ?) - (2, 2012-05-19 14:21:05)
12 sfFilterChain Executing filter "sfExecutionFilter"
13 sfGuardAuthActions Call "sfGuardAuthActions->executeSecure()"
14 sfPHPView Render "sf_app_dir/modules/sfGuardAuth/templates/secureSuccess.php"
15 main Call "sfGuardAuth->executeSignin_form()"
16 sfPartialView Render "sf_app_dir/modules/sfGuardAuth/templates/_signin_form.php"
17 main Set slot "error_message"
18 sfPHPView Decorate content with "sf_app_dir/templates/login.php"
19 sfPHPView Render "sf_app_dir/templates/login.php"
20 main Get slot "error_message"
21 sfWebResponse Send status "HTTP/1.1 403 Forbidden"
22 sfWebResponse Send header "Content-Type: text/html; charset=utf-8"
有什么線索嗎?
最終,我找到了問題,這不是應用程序在請求兩個憑據,而是Symfony正在查看表權限,而我正在使用該組。
非常感謝您的所有回答。
據堆棧跟蹤,用戶需要有兩個 admin
和viewer
的憑據。
如果不是這種情況,則錯誤應該是(請注意[[ & ]] ):
操作“應變/索引”需要憑據“ [[管理員,查看者]]”,轉發至“ sfGuardAuth /安全”
重新檢查您的security.yml或將完整文件粘貼到您的問題中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.