Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a8aa89a

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

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed
Lines 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 <[email protected]>
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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
* @author Wouter de Jong <[email protected]>
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

Lines 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)