我是Ez出版和symfony的新手。我们在Ezpublish中有一个应用程序,用户可以使用其用户名和密码登录。
即使提供了正确的凭据,它也会重定向到登录页面。
我们能够使用相同的凭据登录到后台。我们 仅当最终用户登录到前台时才面临问题。
使用Ezpublish 5.4版。
以下是我的security.yml文件
security:
providers:
ezpublish:
id: ezpublish.security.user_provider
role_hierarchy:
ROLE_USER: []
ROLE_RISKMANAGER: [ROLE_USER]
ROLE_MANAGER: [ROLE_RISKMANAGER]
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
ezpublish_setup:
pattern: ^/ezsetup
security: false
ezpublish_rest_forgotpassword:
pattern: ^/api/ezp/v2/user/forgotpassword
anonymous: ~
#security: false
stateless: true
ezpublish_rest:
pattern: ^/api/ezp/v2
stateless: true
ezpublish_http_basic:
realm: eZ Publish REST API
ezpublish_front:
pattern: ^/
anonymous: ~
ezpublish_rest_session: ~
form_login:
login_path: login
check_path: login_check
require_previous_session: false
use_forward: false
always_use_default_target_path: false
default_target_path: /
use_referer: true
failure_path: /loginfailed
logout: ~
guard:
authenticators:
- project.security.device_authenticator
default:
anonymous: ~
access_control:
#- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
# backend
- { path: ^/api/ezp/v2/user/forgotpassword, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/mot-de-passe-oublie, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/fr/mot-de-passe-oublie, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/creer-votre-compte, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/fr/creer-votre-compte, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/verification-email, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/fr/verification-email, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/completer-votre-compte, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/fr/completer-votre-compte, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/mise-a-jour-mot-de-passe, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/fr/mise-a-jour-mot-de-passe, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/_fos_user_context_hash, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/activer-votre-compte, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/fr/activer-votre-compte, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/bo, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/en/mot-de-passe-oublie, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/en/creer-votre-compte, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/en/verification-email, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/en/completer-votre-compte, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/en/mise-a-jour-mot-de-passe, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/en/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/fr/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/en/_fos_user_context_hash, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/en/activer-votre-compte, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/country/polygons, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/fr/country/polygons, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/en/country/polygons, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/manage-translation, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/.*, role: ROLE_USER }
- { path: ^/en/country/map, role: ROLE_USER }
- { path: ^/en/, role: ROLE_USER }
答案 0 :(得分:0)
如果会话中没有存储以前的页面,则应该更改默认页面,即用户重定向到的页面: 该值可以是相对/绝对URL或Symfony路由名称:
# config/packages/security.yaml
security:
# ...
firewalls:
main:
form_login:
# ...
default_target_path: after_login_route_name
来源:symfony 4官方文档 https://symfony.com/doc/current/security/form_login.html
答案 1 :(得分:0)
我通过HTTPS(而不是HTTP)为我的域提供服务,