Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit27d6697

Browse files
committed
Fixed handling of CSRF logout error
1 parent4f40da5 commit27d6697

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

‎src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,10 @@ private function handleAccessDeniedException(GetResponseForExceptionEvent $event
174174

175175
privatefunctionhandleLogoutException(LogoutException$exception)
176176
{
177+
$event->setException(newAccessDeniedHttpException($exception->getMessage(),$exception));
178+
177179
if (null !==$this->logger) {
178-
$this->logger->info('A LogoutException was thrown.', ['exception' =>$exception]);
180+
$this->logger->info('A LogoutException was thrown; wrapping with AccessDeniedHttpException', ['exception' =>$exception]);
179181
}
180182
}
181183

‎src/Symfony/Component/Security/Http/Tests/Firewall/ExceptionListenerTest.php‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,17 @@ public function testAccessDeniedExceptionNotFullFledged(\Exception $exception, \
160160
$this->assertSame(null ===$eventException ?$exception :$eventException,$event->getException()->getPrevious());
161161
}
162162

163+
publicfunctiontestLogoutException()
164+
{
165+
$event =$this->createEvent(newLogoutException('Invalid CSRF.'));
166+
167+
$listener =$this->createExceptionListener();
168+
$listener->onKernelException($event);
169+
170+
$this->assertEquals('Forbidden',$event->getResponse()->getContent());
171+
$this->assertEquals(403,$event->getResponse()->getStatusCode());
172+
}
173+
163174
publicfunctiongetAccessDeniedExceptionProvider()
164175
{
165176
return [

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp