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

Appearance settings

Commit 42f7dc6

Browse filesBrowse files
committed
feature #42050 [Security] Deprecate TokenInterface::isAuthenticated() (chalasr)
This PR was merged into the 5.4 branch. Discussion ---------- [Security] Deprecate `TokenInterface::isAuthenticated()` | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | todo From symfony/symfony#41613 (comment) > all unauthenticated token use-cases have been replaced with passports (and the removal of anonymous). This means that if you have a token, it should always be authenticated. Commits ------- 33b8fbdd8a [Security] Deprecate `TokenInterface::isAuthenticated()` and `setAuthenticated()`
2 parents 3c2a32a + 2012f93 commit 42f7dc6
Copy full SHA for 42f7dc6

File tree

Expand file treeCollapse file tree

2 files changed

+1
-3
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+1
-3
lines changed

‎Processor/AbstractTokenProcessor.php

Copy file name to clipboardExpand all lines: Processor/AbstractTokenProcessor.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __invoke(array $record): array
4242

4343
if (null !== $token = $this->getToken()) {
4444
$record['extra'][$this->getKey()] = [
45-
'authenticated' => $token->isAuthenticated(),
45+
'authenticated' => $token->isAuthenticated(false), // @deprecated since Symfony 5.4, always true in 6.0
4646
'roles' => $token->getRoleNames(),
4747
];
4848

‎Tests/Processor/TokenProcessorTest.php

Copy file name to clipboardExpand all lines: Tests/Processor/TokenProcessorTest.php
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public function testLegacyProcessor()
3939

4040
$this->assertArrayHasKey('token', $record['extra']);
4141
$this->assertEquals($token->getUsername(), $record['extra']['token']['username']);
42-
$this->assertEquals($token->isAuthenticated(), $record['extra']['token']['authenticated']);
4342
$this->assertEquals(['ROLE_USER'], $record['extra']['token']['roles']);
4443
}
4544

@@ -59,7 +58,6 @@ public function testProcessor()
5958

6059
$this->assertArrayHasKey('token', $record['extra']);
6160
$this->assertEquals($token->getUserIdentifier(), $record['extra']['token']['user_identifier']);
62-
$this->assertEquals($token->isAuthenticated(), $record['extra']['token']['authenticated']);
6361
$this->assertEquals(['ROLE_USER'], $record['extra']['token']['roles']);
6462
}
6563
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.