Symfony 3.1을 사용하여 로그 아웃 기능을 수행하려고하는데 지금까지 작동하지 않습니다. 나는 책 문서를 단계별로 따르고 있지만 내가 얻는 것은 예외를 찾을 수 없다는 것뿐입니다.
"/ logout"경로에 대한 컨트롤러를 찾을 수 없습니다. 경로가 잘못 구성되었습니다.
security.yml 파일에서 올바른 구성 매개 변수 (로그 아웃)를 활성화합니다.
security:
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: ~
# activate different ways to authenticate
form_login:
login_path: login
check_path: login
secured_area:
anonymous: ~
logout:
path: /logout
target: /
그리고 routing.yml 안에 경로를 생성합니다.
logout:
path: /logout
문서에 따르면 컨트롤러가 필요하지 않지만 예외는 컨트롤러 경로가 잘못되었다고 말합니다.
내가 도대체 뭘 잘못하고있는 겁니까?
두 개의 방화벽이 정의되어 있기 때문이라고 생각합니다. 잠시 동안 secured_area 항목을 제거하고 다음과 같이 시도하십시오.
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
anonymous: ~
switch_user: true
form_login:
provider: user_provider
login_path: user_login
check_path: user_login_check
default_target_path: app_welcome
username_parameter: username
password_parameter: password
csrf_parameter: _csrf_token
csrf_token_id: authenticate
csrf_token_generator: security.csrf.token_manager
logout:
path: user_logout
target: app_welcome
로그 아웃 섹션은 기본 방화벽 아래에 있습니다. 기본 방화벽이 작동하면 실제로 필요한 경우 secured_area를 다시 추가 할 수 있습니다.
그리고 예, 게으르고 작업 구성을 복사 / 붙여 넣기했습니다. 당신은 당신의 것과 일치하도록 경로를 조정해야 할 것입니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다