最近のsymfony2で最も単純な認証に問題があります.
私の security.yml :
セキュリティ: エンコーダ: Symfony\Component\Security\Core\User\User: 平文
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
in_memory:
memory:
users:
user: { password: userpass, roles: [ 'ROLE_USER' ] }
admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
login:
# pattern: ^/demo/secured/login$
pattern: /login
security: false
secured_area:
pattern: ^/admin
form_login:
check_path: check
login_path: login
logout:
path: /logout
target: /index
#anonymous: ~
#http_basic:
# realm: "Secured Demo Area"
access_control:
- { path: ^/admin/, roles: ROLE_ADMIN }
および DefaultControler.php の一部
public function loginAction() {
$request = $this->getRequest();
$session = $request->getSession();
if ($request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
$error = $request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
} else {
$error = $session->get(SecurityContext::AUTHENTICATION_ERROR);
}
return $this->render('JimmyTestBundle:Default:login.html.twig', array(
// last username entered by the user
'last_username' => $session->get(SecurityContext::LAST_USERNAME),
'error' => $error,
));
}
public function checkAction()
{
}
私は symfony の Web サイトからクック ブックを読んでいます。checkAction はファイアウォール レイヤーによって解釈されるはずですが、ログインしようとすると、おそらくこのようなものではありません。
コントローラーは応答を返さなければなりません (null が与えられます)。コントローラーのどこかに return ステートメントを追加するのを忘れていませんか? 500 内部サーバー エラー - LogicException
私の login.html.twig もほぼチュートリアルからコピペです。何かアドバイス?