这是我的配置:
security:
providers:
in_memory:
memory:
users:
user:
password: user
roles: 'ROLE_USER'
admin:
password: admin
roles: 'ROLE_ADMIN'
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
secured_area:
anonymous: ~
access_denied_url: backoffice_access_denied
form_login:
login_path: /backoffice/login
check_path: /backoffice/login_check
logout:
path: /backoffice/logout
target: /backoffice
encoders:
Symfony\Component\Security\Core\User\User: plaintext
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
access_control:
- { path: ^/backoffice/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/backoffice, roles: ROLE_ADMIN }
backoffice_logout:
path: /backoffice/logout
backoffice_login_check:
path: /backoffice/login_check
显然我有一个路由/后台/登录控制器,它使用正确的输入名称(_username,_password)呈现登录表单。
当我编译表单时,如果输入错误的用户名和密码数据,我就会出现错误的凭据,但如果输入正确的数据,我会以匿名用户的身份重定向回登录页面。
一些app / logs ...
[2016-03-02 10:39:54] request.INFO: Matched route "backoffice_login_check". {"route_parameters":{"_route":"backoffice_login_check"},"request_uri":"http://DOMAIN/backoffice/login_check"} []
[2016-03-02 10:39:54] security.INFO: User has been authenticated successfully. {"username":"admin"} []
[2016-03-02 10:39:54] event.DEBUG: Listener "Symfony\Component\Security\Http\Firewall::onKernelRequest" stopped propagation of the event "kernel.request". [] []
[2016-03-02 10:39:54] event.DEBUG: Listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest" was not called for event "kernel.request". [] []
[2016-03-02 10:39:54] security.DEBUG: Stored the security token in the session. {"key":"_security_secured_area"} []
[2016-03-02 10:39:54] request.INFO: Matched route "backoffice_index_lead". {"route_parameters":{"_controller":"XXX\\AppBundle\\Controller\\DefaultController::leadAction","_route":"backoffice_index_lead"},"request_uri":"http://DOMAIN/backoffice/lead"} []
[2016-03-02 10:39:54] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2016-03-02 10:39:54] security.DEBUG: Access denied, the user is not fully authenticated; redirecting to authentication entry point. {"exception":"[object] (Symfony\\Component\\Security\\Core\\Exception\\AccessDeniedException(code: 403): Access Denied. at /site/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AccessListener.php:70)"} []
[2016-03-02 10:39:54] security.DEBUG: Calling Authentication entry point. [] []
如何在第2行看到登录成功完成但当控制器重定向到安全时我获得拒绝访问权限(第8行)
我哪里错了? 谢谢。
这是我的config.yml
framework:
#esi: ~
#translator: { fallbacks: ["%locale%"] }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
packages:
v_assets:
version: %app.assets_version%
version_format: "assets/%%2$s/%%1$s"
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
handler_id: ~
fragments: ~
http_method_override: true
我的symfony项目在 NGNIX / HHVM 上运行。
答案 0 :(得分:0)
尝试添加更改会话选项:
class SampleDialog extends JDialog {
/**
* The constructor creates the window with all the controls.
* Constructor takes a JFrame object
*/
SampleDialog(JFrame jframe) {
//pass the parameters to the superclass(JDialog)
super(jframe,true);
Container pane = getContentPane();
JPanel panel = new JPanel();
pane.add(panel);
JTextField userText = new JTextField(20);
userText.setBounds(100, 10, 160, 25);
panel.add(userText);
WindowEvent we = new WindowEvent(this, WindowEvent.WINDOW_CLOSED);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
System.exit(0);
}
});
setSize(200, 200);
setVisible(true);
}
public static void main(String[] args) throws IOException {
SampleDialog sampleDialog = new SampleDialog(new JFrame());
}}
为:
session: ~
答案 1 :(得分:0)
抛出HHVM桶并安装php!