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 a8aa89a

Browse filesBrowse files
committed
Add an interface for security passports which support attributes
1 parent 7df57da commit a8aa89a
Copy full SHA for a8aa89a

File tree

Expand file treeCollapse file tree

3 files changed

+34
-5
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+34
-5
lines changed
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Security\Http\Authenticator\Passport;
13+
14+
/**
15+
* Represents a passport which contains attributes.
16+
*/
17+
interface AttributedPassportInterface extends PassportInterface
18+
{
19+
/**
20+
* @param mixed $value
21+
*/
22+
public function setAttribute(string $name, $value): void;
23+
24+
/**
25+
* @param mixed $default
26+
*
27+
* @return mixed
28+
*/
29+
public function getAttribute(string $name, $default = null);
30+
}

‎src/Symfony/Component/Security/Http/Authenticator/Passport/Passport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Authenticator/Passport/Passport.php
+3-5Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
* @author Wouter de Jong <wouter@wouterj.nl>
2323
*/
24-
class Passport implements UserPassportInterface
24+
class Passport implements UserPassportInterface, AttributedPassportInterface
2525
{
2626
use PassportTrait;
2727

@@ -60,17 +60,15 @@ public function getUser(): UserInterface
6060
}
6161

6262
/**
63-
* @param mixed $value
63+
* {@inheritdoc}
6464
*/
6565
public function setAttribute(string $name, $value): void
6666
{
6767
$this->attributes[$name] = $value;
6868
}
6969

7070
/**
71-
* @param mixed $default
72-
*
73-
* @return mixed
71+
* {@inheritdoc}
7472
*/
7573
public function getAttribute(string $name, $default = null)
7674
{

‎src/Symfony/Component/Security/Http/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ CHANGELOG
66

77
* Deprecate not setting the 5th argument (`$exceptionOnNoToken`) of `AccessListener` to `false`
88
* Deprecate `DeauthenticatedEvent`, use `TokenDeauthenticatedEvent` instead
9+
* Add `AttributedPassportInterface`
910

1011
5.3
1112
---

0 commit comments

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